Project

General

Profile

Revision 17

replaced hardcoded value by MACRO

View differences:

lab2/i8254.h
44 44
#define TIMER_RATE_GEN BIT(2)            /**< @brief Mode 2: rate generator */
45 45
#define TIMER_MODE_MASK 0x0E             /**< @brief Mask for mode */
46 46
#define TIMER_MODE_POS  1                /**< @brief Position of smallest bit from mode */
47
#define TIMER_MODE_2ALT 0x6              /**< @brief Alternative notation for mode 2 */
48
#define TIMER_MODE_3ALT 0x7              /**< @brief Alternative notation for mode 3 */
47 49
#define TIMER_MODE_RED2 0x03             /**< @brief Reduce 3-bit mode to 2-bit mode */
48 50

  
51

  
49 52
/* Counting mode: bit 0 */
50 53

  
51 54
#define TIMER_BCD 0x01 /**< @brief Count in BCD */
lab2/timer.c
100 100
            break;
101 101
        case tsf_mode:
102 102
            conf.count_mode = (st & TIMER_MODE_MASK)>>TIMER_MODE_POS;
103
            if(conf.count_mode == 0x6 || conf.count_mode == 0x7)
103
            if(conf.count_mode == TIMER_MODE_2ALT || conf.count_mode == TIMER_MODE_3ALT)
104 104
                conf.count_mode &= TIMER_MODE_RED2;
105 105
            break;
106 106
        case tsf_base:

Also available in: Unified diff