Changeset 5674767f in rtems


Ignore:
Timestamp:
Sep 9, 2014, 1:18:01 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
b5f9ad2
Parents:
8028089
git-author:
Sebastian Huber <sebastian.huber@…> (09/09/14 13:18:01)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/10/14 05:12:55)
Message:

bsp/qoriq: Fix tm27 support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/powerpc/qoriq/include/tm27.h

    r8028089 r5674767f  
    88
    99/*
    10  * Copyright (c) 2010 embedded brains GmbH.  All rights reserved.
     10 * Copyright (c) 2010-2014 embedded brains GmbH.  All rights reserved.
    1111 *
    1212 *  embedded brains GmbH
    13  *  Obere Lagerstr. 30
     13 *  Dornierstr. 4
    1414 *  82178 Puchheim
    1515 *  Germany
     
    2828#define TMTESTS_TM27_H
    2929
     30#include <assert.h>
     31
    3032#include <libcpu/powerpc-utility.h>
    31 #include <bsp/vectors.h>
     33
     34#include <bsp/irq.h>
     35#include <bsp/qoriq.h>
    3236
    3337#define MUST_WAIT_FOR_INTERRUPT 1
    3438
    35 static void (*tm27_interrupt_handler)(rtems_vector_number);
     39#define IPI_INDEX_LOW 1
    3640
    37 static int tm27_exception_handler( BSP_Exception_frame *frame, unsigned number)
     41#define IPI_INDEX_HIGH 2
     42
     43static void Install_tm27_vector(void (*handler)(rtems_vector_number))
    3844{
    39         (*tm27_interrupt_handler)( 0);
     45  rtems_status_code sc;
     46  rtems_vector_number low = QORIQ_IRQ_IPI_0 + IPI_INDEX_LOW;
     47  rtems_vector_number high = QORIQ_IRQ_IPI_0 + IPI_INDEX_HIGH;
    4048
    41         return 0;
     49  sc = rtems_interrupt_handler_install(
     50    low,
     51    "tm17 low",
     52    RTEMS_INTERRUPT_UNIQUE,
     53    (rtems_interrupt_handler) handler,
     54    NULL
     55  );
     56  assert(sc == RTEMS_SUCCESSFUL);
     57
     58  sc = qoriq_pic_set_priority(low, 1, NULL);
     59  assert(sc == RTEMS_SUCCESSFUL);
     60
     61  sc = rtems_interrupt_handler_install(
     62    high,
     63    "tm17 high",
     64    RTEMS_INTERRUPT_UNIQUE,
     65    (rtems_interrupt_handler) handler,
     66    NULL
     67  );
     68  assert(sc == RTEMS_SUCCESSFUL);
     69
     70  sc = qoriq_pic_set_priority(high, 2, NULL);
     71  assert(sc == RTEMS_SUCCESSFUL);
    4272}
    4373
    44 void Install_tm27_vector( void (*handler)(rtems_vector_number))
     74static void qoriq_tm27_cause(uint32_t ipi_index)
    4575{
    46   int rv = 0;
     76  uint32_t self = ppc_processor_id();
    4777
    48   tm27_interrupt_handler = handler;
    49 
    50   rv = ppc_exc_set_handler( ASM_DEC_VECTOR, tm27_exception_handler);
    51   if (rv < 0) {
    52     printk( "Error installing clock interrupt handler!\n");
    53   }
     78  qoriq.pic.per_cpu[self].ipidr[ipi_index].reg = UINT32_C(1) << self;
    5479}
    5580
    56 #define Cause_tm27_intr() \
    57   ppc_set_decrementer_register( 8)
     81static void Cause_tm27_intr()
     82{
     83  qoriq_tm27_cause(IPI_INDEX_LOW);
     84}
    5885
    59 #define Clear_tm27_intr() \
    60   ppc_set_decrementer_register( UINT32_MAX)
     86static void Clear_tm27_intr()
     87{
     88  /* Nothing to do */
     89}
    6190
    62 #define Lower_tm27_intr() \
    63   (void) ppc_external_exceptions_enable()
     91static void Lower_tm27_intr(void)
     92{
     93  qoriq_tm27_cause(IPI_INDEX_HIGH);
     94}
    6495
    6596#endif /* TMTESTS_TM27_H */
Note: See TracChangeset for help on using the changeset viewer.