Changeset 0743eae in rtems


Ignore:
Timestamp:
Oct 11, 2007, 12:56:09 PM (12 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.9, master
Children:
053c2f4
Parents:
8a781ad7
Message:

2007-10-11 Daniel Hellstrom <daniel@…>

  • Makefile.am, shared/can/occan.c, shared/include/ambapp.h: Add initial i2c and update OC-CAN support.
  • shared/i2c/i2cmst.c, shared/include/i2cmst.h: New files.
Location:
c/src/lib/libbsp/sparc
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/sparc/ChangeLog

    r8a781ad7 r0743eae  
     12007-10-11      Daniel Hellstrom <daniel@gaisler.com>
     2
     3        * Makefile.am, shared/can/occan.c, shared/include/ambapp.h: Add initial
     4        i2c and update OC-CAN support.
     5        * shared/i2c/i2cmst.c, shared/include/i2cmst.h: New files.
     6
    172007-09-21      Daniel Hellstrom <daniel@gaisler.com>
    28
  • c/src/lib/libbsp/sparc/Makefile.am

    r8a781ad7 r0743eae  
    6060EXTRA_DIST += shared/include/b1553brm_rasta.h
    6161
     62# I2C-master (I2CMST)
     63EXTRA_DIST += shared/i2c/i2cmst.c
     64EXTRA_DIST += shared/include/i2cmst.h
     65
    6266include $(top_srcdir)/../../../automake/subdirs.am
    6367include $(top_srcdir)/../../../automake/local.am
  • c/src/lib/libbsp/sparc/shared/can/occan.c

    r8a781ad7 r0743eae  
    199199#endif
    200200
    201 #define MAX_TSEG1 7
    202 #define MAX_TSEG2 15
     201#define MAX_TSEG2 7
     202#define MAX_TSEG1 15
    203203
    204204#if 0
     
    729729#endif
    730730
    731 /* This function calculates BTR0 BTR1 values for a given bitrate.
    732  * Heavily based on mgt_mscan_bitrate() from peak driver, which
    733  * in turn is based on work by Arnaud Westenberg.
     731/* This function calculates BTR0 and BTR1 values for a given bitrate.
    734732 *
    735733 * Set communication parameters.
    736  * baud rate in Hz
    737  * input clock frequency of can core in Hz (system frequency)
    738  * sjw synchronization jump width (0-3) prescaled clock cycles
    739  * sampl_pt sample point in % (0-100) sets (TSEG1+2)/(TSEG1+TSEG2+3)
    740  *                                                               ratio
     734 * \param clock_hz OC_CAN Core frequency in Hz.
     735 * \param rate Requested baud rate in bits/second.
     736 * \param result Pointer to where resulting BTRs will be stored.
     737 * \return zero if successful to calculate a baud rate.
    741738 */
    742739static int occan_calc_speedregs(unsigned int clock_hz, unsigned int rate, occan_speed_regs *result){
     
    749746        int sampl_pt = 90;
    750747
    751         if ( (rate<10000) || (rate>1000000) ){
     748        if ( (rate<5000) || (rate>1000000) ){
    752749                /* invalid speed mode */
    753750                return -1;
     
    817814                tseg2 = best_tseg - tseg1 - 2;
    818815        }
    819 /*
    820         result->sjw = sjw;
    821         result->brp = best_brp;
    822         result->tseg1 = tseg1;
    823         result->tseg2 = tseg2;
    824 */
     816
    825817        result->btr0 = (sjw<<OCCAN_BUSTIM_SJW_BIT) | (best_brp&OCCAN_BUSTIM_BRP);
    826818        result->btr1 = (0<<7) | (tseg2<<OCCAN_BUSTIM_TSEG2_BIT) | tseg1;
     
    835827        priv->regs->bustim0 = timing->btr0;
    836828        priv->regs->bustim1 = timing->btr1;
    837         /*
    838         priv->regs->bustim0 = (timing->sjw<<OCCAN_BUSTIM_SJW_BIT) | (timing->brp&OCCAN_BUSTIM_BRP);
    839         priv->regs->bustim1 = (timing->sam<<7) | (timing->tseg2<<OCCAN_BUSTIM_TSEG2_BIT) | timing->tseg1;
    840         */
    841829        return 0;
    842830}
  • c/src/lib/libbsp/sparc/shared/include/ambapp.h

    r8a781ad7 r0743eae  
    5959#define GAISLER_SPACEWIRE 0x1f
    6060#define GAISLER_AHB2AHB   0x20
     61#define GAISLER_I2CMST    0x28
     62#define GAISLER_GRSPW2    0x29
    6163#define GAISLER_GRHCAN    0x34
    6264#define GAISLER_GRFIFO    0x35
Note: See TracChangeset for help on using the changeset viewer.