Ignore:
Timestamp:
Mar 5, 2013, 4:00:09 PM (12 years ago)
Author:
meunier
Message:

Ajout du malloc dans le Giet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/sys/drivers.c

    r228 r232  
    120120#if (NB_TIMERS_MAX > 0)
    121121in_unckdata volatile unsigned char _user_timer_event[NB_CLUSTERS * NB_TIMERS_MAX]
    122 = { [0 ... ((NB_CLUSTERS * NB_TIMERS_MAX) - 1)] = 0 };
     122                            = { [0 ... ((NB_CLUSTERS * NB_TIMERS_MAX) - 1)] = 0 };
    123123#endif
    124124
     
    205205    bloup++; // to avoid a warning
    206206#else
    207     unsigned int * timer_address = (unsigned int *)((char *) &seg_tim_base +
     207    unsigned int * timer_address = (unsigned int *) ((char *) &seg_tim_base +
    208208            (cluster_id * CLUSTER_SIZE));
    209209
     
    213213    return 0;
    214214}
     215
     216
     217////////////////////////////////////////////////
     218// _timer_reset_irq_cpt()
     219////////////////////////////////////////////////
     220//unsigned int _timer_reset_irq_cpt(unsigned int cluster_id, unsigned int local_id) {
     221//    // parameters checking
     222//    if ( cluster_id >= NB_CLUSTERS)    return 1;
     223//    if ( local_id >= NB_TIMERS_MAX ) return 2;
     224//
     225//#if USE_XICU
     226//#error // not implemented
     227//#else
     228//    unsigned int * timer_address = (unsigned int *) ((char *) &seg_tim_base + (cluster_id * CLUSTER_SIZE));
     229//
     230//    timer_address[local_id * TIMER_SPAN + TIMER_RESETIRQ] = 1;
     231//#endif
     232//
     233//    return 0;
     234//}
    215235
    216236
     
    264284unsigned int _tty_write(const char * buffer, unsigned int length) {
    265285    unsigned int nwritten;
    266     unsigned int task_id = _get_current_task_id();
     286    unsigned int task_id = _get_proc_task_id();
    267287    unsigned int tty_id = _get_context_slot(task_id, CTX_TTY_ID);
    268288
     
    300320//////////////////////////////////////////////////////////////////////////////
    301321unsigned int _tty_read(char * buffer, unsigned int length) {
    302     unsigned int task_id = _get_current_task_id();
     322    unsigned int task_id = _get_proc_task_id();
    303323    unsigned int tty_id = _get_context_slot(task_id, CTX_TTY_ID);
    304324
     
    567587
    568588    // get user space page table virtual address
    569     unsigned int task_id = _get_current_task_id();
     589    unsigned int task_id = _get_proc_task_id();
    570590    unsigned int user_pt_vbase = _get_context_slot(task_id, CTX_PTAB_ID);
    571591
     
    877897
    878898    // get DMA channel and compute DMA vbase address
    879     unsigned int task_id    = _get_current_task_id();
     899    unsigned int task_id    = _get_proc_task_id();
    880900    unsigned int dma_id     = _get_context_slot(task_id, CTX_DMA_ID);
    881901    unsigned int cluster_id = dma_id / NB_DMAS_MAX;
     
    10121032unsigned int _dma_completed() {
    10131033#if NB_DMAS_MAX > 0
    1014     unsigned int task_id = _get_current_task_id();
     1034    unsigned int task_id = _get_proc_task_id();
    10151035    unsigned int dma_id  = _get_context_slot(task_id, CTX_DMA_ID);
    10161036    unsigned int dma_ret;
     
    12461266}
    12471267
     1268///////////////////////////////////////////////////////////////////////////////////
     1269// _heap_info()
     1270// This function returns the information associated to a heap (size and vaddr)
     1271// It uses the global task id (CTX_GTID_ID, unique for each giet task) and the
     1272// vspace id (CTX_VSID_ID) defined in the context
     1273///////////////////////////////////////////////////////////////////////////////////
     1274unsigned int _heap_info(unsigned int * vaddr, unsigned int * size) {
     1275    mapping_header_t * header  = (mapping_header_t *) (&seg_mapping_base);
     1276    mapping_task_t * tasks     = _get_task_base(header);
     1277    mapping_vobj_t * vobjs     = _get_vobj_base(header);
     1278    mapping_vspace_t * vspaces = _get_vspace_base(header);
     1279    unsigned int taskid        = _get_context_slot(_get_proc_task_id(), CTX_GTID_ID);
     1280    unsigned int vspaceid      = _get_context_slot(_get_proc_task_id(), CTX_VSID_ID);
     1281    int heap_local_vobjid      = tasks[taskid].heap_vobjid;
     1282    if (heap_local_vobjid != -1) {
     1283        unsigned int vobjheapid = heap_local_vobjid + vspaces[vspaceid].vobj_offset;
     1284        *vaddr                  = vobjs[vobjheapid].vaddr;
     1285        *size                   = vobjs[vobjheapid].length;
     1286        return 0;
     1287    }
     1288    else {
     1289        *vaddr = 0;
     1290        *size = 0;
     1291        return 0;
     1292    }
     1293}
     1294
    12481295// Local Variables:
    12491296// tab-width: 4
Note: See TracChangeset for help on using the changeset viewer.