4.104.114.84.95
Rev | Line | |
---|
[61ba9763] | 1 | /* |
---|
| 2 | * C4X IO Information |
---|
| 3 | * |
---|
| 4 | * $Id$ |
---|
| 5 | */ |
---|
| 6 | |
---|
| 7 | #ifndef __C4XIO_h |
---|
| 8 | #define __C4XIO_h |
---|
| 9 | |
---|
| 10 | /* |
---|
| 11 | * The following section of C4x timer code is based on C40 specific |
---|
| 12 | * timer code from Ran Cabell <rcabell@norfolk.infi.net>. The |
---|
| 13 | * only C3x/C4x difference spotted was the address of the timer. |
---|
| 14 | * The names have been changed to be more RTEMS like. |
---|
| 15 | */ |
---|
| 16 | |
---|
| 17 | struct c4x_timer { |
---|
| 18 | volatile int tcontrol; |
---|
| 19 | volatile int r1[3]; |
---|
| 20 | volatile int tcounter; |
---|
| 21 | volatile int r2[3]; |
---|
| 22 | volatile int tperiod; |
---|
| 23 | }; |
---|
| 24 | |
---|
| 25 | #ifdef _TMS320C40 |
---|
| 26 | #define C4X_TIMER_0 ((struct c4x_timer*)0x100020) |
---|
| 27 | #else |
---|
| 28 | #define C4X_TIMER_0 ((struct c4x_timer*)0x808020) |
---|
| 29 | #define C4X_TIMER_1 ((struct c4x_timer*)0x808030) |
---|
| 30 | #endif |
---|
| 31 | |
---|
| 32 | #define c4x_timer_start( _timer ) \ |
---|
| 33 | _timer->tcontrol=0x02c1 |
---|
| 34 | |
---|
| 35 | #define c4x_timer_stop( _timer ) _timer->tcontrol = 0 |
---|
| 36 | |
---|
| 37 | #define c4x_timer_get_counter( _timer ) (volatile int)(_timer->tcounter) |
---|
| 38 | |
---|
| 39 | #define c4x_timer_set_counter( _timer, _value ) \ |
---|
| 40 | do { \ |
---|
| 41 | (volatile int)(_timer->tcounter) = _value; \ |
---|
| 42 | } while (0); |
---|
| 43 | |
---|
| 44 | #define c4x_timer_get_period( _timer ) (volatile int)(_timer->tperiod) |
---|
| 45 | |
---|
| 46 | #define c4x_timer_set_period( _timer, _value ) \ |
---|
| 47 | do { \ |
---|
| 48 | (volatile int)(_timer->tperiod) = _value; \ |
---|
| 49 | } while (0); |
---|
| 50 | |
---|
| 51 | #endif |
---|
| 52 | /* end if include file */ |
---|
Note: See
TracBrowser
for help on using the repository browser.