Changeset 22624

Show
Ignore:
Timestamp:
10/20/07 08:11:16 (13 months ago)
Author:
sbenedetto
Message:

* Renaming macros

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • haiku/trunk/src/add-ons/kernel/busses/usb/ohci_hardware.h

    r22555 r22624  
    2020 
    2121#define OHCI_REVISION                           0x00 
    22 #define         OHCI_REV_LO(rev)                ((rev) & 0x0f) 
    23 #define         OHCI_REV_HI(rev)                (((rev) >> 4) & 0x03) 
    24 #define         OHCI_REV_LEGACY(rev)    ((rev) & 0x10) 
     22#define OHCI_REVISION_LOW(rev)          ((rev) & 0x0f) 
     23#define OHCI_REVISION_HIGH(rev)         (((rev) >> 4) & 0x03) 
     24#define OHCI_REVISION_LEGACY(rev)       ((rev) & 0x10) 
    2525 
    2626// -------------------------------- 
     
    2828// -------------------------------- 
    2929 
    30 #define OHCI_CONTROL                            0x04 
    31 #define         OHCI_CBSR_MASK                  0x00000003 // Control-Bulk Service Ratio 
    32 #define                 OHCI_RATIO_1_1          0x00000000 
    33 #define                 OHCI_RATIO_1_2          0x00000001 
    34 #define                 OHCI_RATIO_1_3          0x00000002 
    35 #define                 OHCI_RATIO_1_4          0x00000003 
    36 #define         OHCI_PLE                                0x00000004 // Periodic List Enable  
    37 #define         OHCI_IE                                 0x00000008 // Isochronous Enable  
    38 #define         OHCI_CLE                                0x00000010 // Control List Enable  
    39 #define         OHCI_BLE                                0x00000020 // Bulk List Enable  
    40 #define         OHCI_HCFS_MASK                  0x000000c0 // HostControllerFunctionalState  
    41 #define         OHCI_HCFS_RESET                 0x00000000 
    42 #define         OHCI_HCFS_RESUME                0x00000040 
    43 #define         OHCI_HCFS_OPERATIONAL   0x00000080 
    44 #define         OHCI_HCFS_SUSPEND               0x000000c0 
    45 #define         OHCI_IR                                 0x00000100 // Interrupt Routing  
    46 #define         OHCI_RWC                                0x00000200 // Remote Wakeup Connected  
    47 #define         OHCI_RWE                                0x00000400 // Remote Wakeup Enabled  
     30#define OHCI_CONTROL                                                    0x04 
     31#define OHCI_CONTROL_BULK_SERVICE_RATIO_MASK    0x00000003 
     32#define OHCI_CONTROL_BULK_RATIO_1_1                             0x00000000 
     33#define OHCI_CONTROL_BULK_RATIO_1_2                             0x00000001 
     34#define OHCI_CONTROL_BULK_RATIO_1_3                             0x00000002 
     35#define OHCI_CONTROL_BULK_RATIO_1_4                             0x00000003 
     36#define OHCI_PERIODIC_LIST_ENABLE                               0x00000004 
     37#define OHCI_ISOCHRONOUS_ENABLE                                 0x00000008 
     38#define OHCI_CONTROL_LIST_ENABLE                                0x00000010 
     39#define OHCI_BULK_LIST_ENABLE                                   0x00000020 
     40#define OHCI_HC_FUNCTIONAL_STATE_MASK                   0x000000c0 
     41#define OHCI_HC_FUNCTIONAL_STATE_RESET                  0x00000000 
     42#define OHCI_HC_FUNCTIONAL_STATE_RESUME                 0x00000040 
     43#define OHCI_HC_FUNCTIONAL_STATE_OPERATIONAL    0x00000080 
     44#define OHCI_HC_FUNCTIONAL_STATE_SUSPEND                0x000000c0 
     45#define OHCI_INTERRUPT_ROUTING                                  0x00000100 
     46#define OHCI_REMOTE_WAKEUP_CONNECTED                    0x00000200 
     47#define OHCI_REMORE_WAKEUP_ENABLED                              0x00000400 
    4848 
    4949// -------------------------------- 
     
    5151// -------------------------------- 
    5252 
    53 #define OHCI_COMMAND_STATUS     0x08 
    54 #define         OHCI_HCR                                0x00000001 // Host Controller Reset  
    55 #define         OHCI_CLF                                0x00000002 // Control List Filled  
    56 #define         OHCI_BLF                                0x00000004 // Bulk List Filled  
    57 #define         OHCI_OCR                                0x00000008 // Ownership Change Request  
    58 #define         OHCI_SOC_MASK                   0x00030000 // Scheduling Overrun Count  
     53#define OHCI_COMMAND_STATUS                                             0x08 
     54#define OHCI_HOST_CONTROLLER_RESET                              0x00000001 
     55#define OHCI_CONTROL_LIST_FILLED                                0x00000002 
     56#define OHCI_BULK_LIST_FILLED                                   0x00000004 
     57#define OHCI_OWNERSHIP_CHANGE_REQUEST                   0x00000008 
     58#define OHCI_SCHEDULING_OVERRUN_COUNT_MASK              0x00030000 
    5959 
    6060// -------------------------------- 
     
    6262// -------------------------------- 
    6363 
    64 #define OHCI_INTERRUPT_STATUS   0x0c 
    65 #define         OHCI_SO                                 0x00000001 // Scheduling Overrun 
    66 #define         OHCI_WDH                                0x00000002 // Writeback Done Head  
    67 #define         OHCI_SF                                 0x00000004 // Start of Frame  
    68 #define         OHCI_RD                                 0x00000008 // Resume Detected  
    69 #define         OHCI_UE                                 0x00000010 // Unrecoverable Error  
    70 #define         OHCI_FNO                                0x00000020 // Frame Number Overflow  
    71 #define         OHCI_RHSC                               0x00000040 // Root Hub Status Change  
    72 #define         OHCI_OC                                 0x40000000 // Ownership Change  
    73 #define         OHCI_MIE                                0x80000000 // Master Interrupt Enable  
     64#define OHCI_INTERRUPT_STATUS                   0x0c 
     65#define OHCI_SCHEDULING_OVERRUN                 0x00000001 
     66#define OHCI_WRITEBACK_DONE_HEAD                0x00000002 
     67#define OHCI_START_OF_FRAME                             0x00000004 
     68#define OHCI_RESUME_DETECTED                    0x00000008 
     69#define OHCI_UNRECOVERABLE_ERROR                0x00000010 
     70#define OHCI_FRAME_NUMBER_OVERFLOW              0x00000020 
     71#define OHCI_ROOT_HUB_STATUS_CHANGE             0x00000040 
     72#define OHCI_OWNERSHIP_CHANGE                   0x40000000 
     73#define OHCI_MASTER_INTERRUPT_ENABLE    0x80000000 
    7474 
    7575// -------------------------------- 
     
    139139// -------------------------------- 
    140140 
    141 #define OHCI_FM_INTERVAL                        0x34 
    142 #define         OHCI_GET_IVAL(s)                ((s) & 0x3fff) 
    143 #define         OHCI_GET_FSMPS(s)               (((s) >> 16) & 0x7fff) 
    144 #define         OHCI_FIT                                0x80000000 
     141#define OHCI_FRAME_INTERVAL                                     0x34 
     142#define OHCI_GET_INTERVAL_VALUE(s)                      ((s) & 0x3fff) 
     143#define OHCI_GET_FS_LARGEST_DATA_PACKET(s)      (((s) >> 16) & 0x7fff) 
     144#define OHCI_FRAME_INTERVAL_TOGGLE                      0x80000000 
    145145 
    146146// -------------------------------- 
     
    148148// -------------------------------- 
    149149 
    150 #define OHCI_FM_REMAINING                       0x38 
     150#define OHCI_FRAME_REMAINING                    0x38 
    151151 
    152152// -------------------------------- 
     
    154154// -------------------------------- 
    155155 
    156 #define OHCI_FM_NUMBER                          0x3c 
     156#define OHCI_FRAME_NUMBER                               0x3c 
    157157 
    158158// -------------------------------- 
     
    160160// -------------------------------- 
    161161 
    162 #define OHCI_PERIODIC_START                     0x40 
    163  
    164 // -------------------------------- 
    165 //      LS treshold register (section 7.3.5) 
    166 // -------------------------------- 
    167  
    168 #define OHCI_LS_THRESHOLD                       0x44 
     162#define OHCI_PERIODIC_START                             0x40 
     163 
     164// -------------------------------- 
     165//      Low Speed (LS) treshold register (section 7.3.5) 
     166// -------------------------------- 
     167 
     168#define OHCI_LOW_SPEED_THRESHOLD                0x44 
    169169 
    170170// -------------------------------- 
     
    176176// -------------------------------- 
    177177 
    178 #define OHCI_RH_DESCRIPTOR_A            0x48 
    179 #define         OHCI_GET_PORT_COUNT(s)  ((s) & 0xff) 
    180 #define         OHCI_PSM                                0x0100     // Power Switching Mode 
    181 #define         OHCI_NPS                                0x0200     // No Power Switching 
    182 #define         OHCI_DT                                 0x0400     // Device Type 
    183 #define         OHCI_OCPM                               0x0800     // Overcurrent Protection Mode  
    184 #define         OHCI_NOCP                               0x1000     // No Overcurrent Protection  
    185 #define         OHCI_GET_POTPGT(s)              ((s) >> 24) 
     178#define OHCI_RH_DESCRIPTOR_A                                            0x48 
     179#define OHCI_RH_GET_PORT_COUNT(s)                                       ((s) & 0xff) 
     180#define OHCI_RH_POWER_SWITCHING_MODE                            0x0100 
     181#define OHCI_RH_NO_POWER_SWITCHING                                      0x0200 
     182#define OHCI_RH_DEVICE_TYPE                                                     0x0400 
     183#define OHCI_RH_OVER_CURRENT_PROTECTION_MODE            0x0800 
     184#define OHCI_RH_NO_OVER_CURRENT_PROTECTION_MODE         0x1000 
     185#define OHCI_RH_GET_POWER_ON_TO_POWER_GOOD_TIME(s)      ((s) >> 24) 
    186186 
    187187// -------------------------------- 
     
    195195// -------------------------------- 
    196196 
    197 #define OHCI_RH_STATUS                          0x50 
    198 #define         OHCI_LPS                                0x00000001 // Local Power Status  
    199 #define         OHCI_OCI                                0x00000002 // OverCurrent Indicator  
    200 #define         OHCI_DRWE                               0x00008000 // Device Remote Wakeup Enable  
    201 #define         OHCI_LPSC                               0x00010000 // Local Power Status Change 
    202 #define         OHCI_CCIC                               0x00020000 // OverCurrent Indicator Change 
    203 #define         OHCI_CRWE                               0x80000000 // Clear Remote Wakeup Enable 
     197#define OHCI_RH_STATUS                                                  0x50 
     198#define OHCI_RH_LOCAL_POWER_STATUS                              0x00000001 
     199#define OHCI_RH_OVER_CURRENT_INDICATOR                  0x00000002 
     200#define OHCI_RH_DEVICE_REMOTE_WAKEUP_ENABLE             0x00008000 
     201#define OHCI_RH_LOCAL_POWER_STATUS_CHANGE               0x00010000 
     202#define OHCI_RH_OVER_CURRENT_INDICATOR_CHANGE   0x00020000 
     203#define OHCI_RH_CLEAR_REMOTE_WAKEUP_ENABLE              0x80000000 
    204204 
    205205// -------------------------------- 
     
    207207// -------------------------------- 
    208208 
    209 #define OHCI_RH_PORT_STATUS(n)          (0x50 + (n)*4) // 1 based indexing 
    210 #define     OHCI_PORTSTATUS_CCS     0x00000001 // Current Connection Status 
    211 #define     OHCI_PORTSTATUS_PES     0x00000002 // Port Enable Status 
    212 #define     OHCI_PORTSTATUS_PSS     0x00000004 // Port Suspend Status 
    213 #define     OHCI_PORTSTATUS_POCI    0x00000008 // Port Overcurrent Indicator 
    214 #define     OHCI_PORTSTATUS_PRS     0x00000010 // Port Reset Status 
    215 #define     OHCI_PORTSTATUS_PPS     0x00000100 // Port Power Status 
    216 #define     OHCI_PORTSTATUS_LSDA    0x00000200 // Low Speed Device Attached 
    217 #define     OHCI_PORTSTATUS_CSC     0x00010000 // Connection Status Change 
    218 #define     OHCI_PORTSTATUS_PESC    0x00020000 // Port Enable Status Change 
    219 #define     OHCI_PORTSTATUS_PSSC    0x00040000 // Port Suspend Status change 
    220 #define     OHCI_PORTSTATUS_OCIC    0x00080000 // Port Overcurrent Change 
    221 #define     OHCI_PORTSTATUS_PRSC    0x00100000 // Port Reset Status Change 
     209#define OHCI_RH_PORT_STATUS(n)          (0x50 + (n) * 4) // 1 based indexing 
     210#define OHCI_RH_PORTSTATUS_CCS          0x00000001              // Current Connection Status 
     211#define OHCI_RH_PORTSTATUS_PES          0x00000002              // Port Enable Status 
     212#define OHCI_RH_PORTSTATUS_PSS          0x00000004              // Port Suspend Status 
     213#define OHCI_RH_PORTSTATUS_POCI         0x00000008              // Port Overcurrent Indicator 
     214#define OHCI_RH_PORTSTATUS_PRS          0x00000010              // Port Reset Status 
     215#define OHCI_RH_PORTSTATUS_PPS          0x00000100              // Port Power Status 
     216#define OHCI_RH_PORTSTATUS_LSDA         0x00000200              // Low Speed Device Attached 
     217#define OHCI_RH_PORTSTATUS_CSC          0x00010000              // Connection Status Change 
     218#define OHCI_RH_PORTSTATUS_PESC         0x00020000              // Port Enable Status Change 
     219#define OHCI_RH_PORTSTATUS_PSSC         0x00040000              // Port Suspend Status change 
     220#define OHCI_RH_PORTSTATUS_OCIC         0x00080000              // Port Overcurrent Change 
     221#define OHCI_RH_PORTSTATUS_PRSC         0x00100000              // Port Reset Status Change 
    222222 
    223223// -------------------------------- 
     
    225225// -------------------------------- 
    226226 
    227 #define OHCI_LES                                        (OHCI_PLE | OHCI_IE | OHCI_CLE | OHCI_BLE) 
     227#define OHCI_LES                                        (OHCI_PLE | OHCI_IE | OHCI_CLE | OHCI_BLE) 
    228228 
    229229// -------------------------------- 
     
    231231// -------------------------------- 
    232232 
    233 #define OHCI_ALL_INTRS                          (OHCI_SO | OHCI_WDH | OHCI_SF | OHCI_RD | OHCI_UE | OHCI_FNO | OHCI_RHSC | OHCI_OC) 
     233#define OHCI_ALL_INTRS                          (OHCI_SO | OHCI_WDH | OHCI_SF | OHCI_RD | OHCI_UE | OHCI_FNO | OHCI_RHSC | OHCI_OC) 
    234234 
    235235// -------------------------------- 
     
    237237// --------------------------------      
    238238                                         
    239 #define OHCI_NORMAL_INTRS                       (OHCI_SO | OHCI_WDH | OHCI_RD | OHCI_UE | OHCI_RHSC) 
     239#define OHCI_NORMAL_INTRS                       (OHCI_SO | OHCI_WDH | OHCI_RD | OHCI_UE | OHCI_RHSC) 
    240240 
    241241// -------------------------------- 
     
    243243// -------------------------------- 
    244244 
    245 #define OHCI_FSMPS(i)                           (((i-210)*6/7) << 16) 
     245#define OHCI_FSMPS(i)                           (((i - 210) * 6 / 7) << 16) 
    246246 
    247247// -------------------------------- 
     
    249249// -------------------------------- 
    250250 
    251 #define OHCI_PERIODIC(i)                        ((i)*9/10) 
     251#define OHCI_PERIODIC(i)                        ((i) * 9 / 10) 
    252252 
    253253// -------------------------------- 
     
    265265typedef struct ohci_hcca  
    266266{ 
    267         addr_t          hcca_interrupt_table[OHCI_NUMBER_OF_INTERRUPTS]; 
    268         uint32          hcca_frame_number; 
    269         addr_t          hcca_done_head; 
     267        uint32          hcca_interrupt_table[OHCI_NUMBER_OF_INTERRUPTS]; 
     268        uint16          hcca_frame_number; 
     269        uint32          hcca_done_head; 
    270270        uint8           hcca_reserved_for_hc[116]; 
    271271}; 
     
    323323}; 
    324324 
    325 #define OHCI_BUFFER_ROUNDING                    0x00040000              // Buffer Rounding  
    326 #define OHCI_TD_DIRECTION_PID_MASK              0x00180000              // Direction / PID  
    327 #define OHCI_TD_DIRECTION_PID_SETUP             0x00000000 
    328 #define OHCI_TD_DIRECTION_PID_OUT               0x00080000 
    329 #define OHCI_TD_DIRECTION_PID_IN                0x00100000 
    330 #define OHCI_TD_GET_DELAY_INTERRUPT(x)  (((x) >> 21) & 7)       // Delay Interrupt  
    331 #define OHCI_TD_SET_DELAY_INTERRUPT(x)  ((x) << 21) 
    332 #define OHCI_TD_NO_INTERRUPT                    0x00e00000 
    333 #define OHCI_TD_INTERRUPT_MASK                  0x00e00000 
    334 #define OHCI_TD_TOGGLE_CARRY                    0x00000000 
    335 #define OHCI_TD_TOGGLE_0                                0x02000000 
    336 #define OHCI_TD_TOGGLE_1                                0x03000000 
    337 #define OHCI_TD_TOGGLE_MASK                             0x03000000 
    338 #define OHCI_TD_GET_ERROR_COUNT(x)              (((x) >> 26) & 3)       // Error Count  
    339 #define OHCI_TD_GET_CONDITION_CODE(x)   ((x) >> 28)                     // Condition Code  
    340 #define OHCI_TD_NO_CONDITION_CODE               0xf0000000 
     325#define OHCI_BUFFER_ROUNDING                    0x00040000 
     326#define OHCI_TD_DIRECTION_PID_MASK              0x00180000 
     327#define OHCI_TD_DIRECTION_PID_SETUP             0x00000000 
     328#define OHCI_TD_DIRECTION_PID_OUT               0x00080000 
     329#define OHCI_TD_DIRECTION_PID_IN                0x00100000 
     330#define OHCI_TD_GET_DELAY_INTERRUPT(x)  (((x) >> 21) & 7) 
     331#define OHCI_TD_SET_DELAY_INTERRUPT(x)  ((x) << 21) 
     332#define OHCI_TD_NO_INTERRUPT                    0x00e00000 
     333#define OHCI_TD_INTERRUPT_MASK                  0x00e00000 
     334#define OHCI_TD_TOGGLE_CARRY                    0x00000000 
     335#define OHCI_TD_TOGGLE_0                                0x02000000 
     336#define OHCI_TD_TOGGLE_1                                0x03000000 
     337#define OHCI_TD_TOGGLE_MASK                             0x03000000 
     338#define OHCI_TD_GET_ERROR_COUNT(x)              (((x) >> 26) & 3) 
     339#define OHCI_TD_GET_CONDITION_CODE(x)   ((x) >> 28) 
     340#define OHCI_TD_NO_CONDITION_CODE               0xf0000000 
    341341 
    342342#define OHCI_GENERAL_TD_ALIGN 16 
     
    356356}; 
    357357 
    358 #define OHCI_ITD_GET_STARTING_FRAME(x)                  ((x) & 0x0000ffff) 
    359 #define OHCI_ITD_SET_STARTING_FRAME(x)                  ((x) & 0xffff) 
    360 #define OHCI_ITD_GET_DELAY_INTERRUPT(x)                 (((x) >> 21) & 7) 
    361 #define OHCI_ITD_SET_DELAY_INTERRUPT(x)                 ((x) << 21) 
    362 #define OHCI_ITD_NO_INTERRUPT                                   0x00e00000 
    363 #define OHCI_ITD_GET_FRAME_COUNT(x)                             ((((x) >> 24) & 7) + 1) 
    364 #define OHCI_ITD_SET_FRAME_COUNT(x)                             (((x) - 1) << 24) 
    365 #define OHCI_ITD_GET_CONDITION_CODE(x)                  ((x) >> 28) 
    366 #define OHCI_ITD_NO_CONDITION_CODE                              0xf0000000 
     358#define OHCI_ITD_GET_STARTING_FRAME(x)                  ((x) & 0x0000ffff) 
     359#define OHCI_ITD_SET_STARTING_FRAME(x)                  ((x) & 0xffff) 
     360#define OHCI_ITD_GET_DELAY_INTERRUPT(x)                 (((x) >> 21) & 7) 
     361#define OHCI_ITD_SET_DELAY_INTERRUPT(x)                 ((x) << 21) 
     362#define OHCI_ITD_NO_INTERRUPT                                   0x00e00000 
     363#define OHCI_ITD_GET_FRAME_COUNT(x)                             ((((x) >> 24) & 7) + 1) 
     364#define OHCI_ITD_SET_FRAME_COUNT(x)                             (((x) - 1) << 24) 
     365#define OHCI_ITD_GET_CONDITION_CODE(x)                  ((x) >> 28) 
     366#define OHCI_ITD_NO_CONDITION_CODE                              0xf0000000 
    367367 
    368368// TO FIX 
     
    370370#define OHCI_ITD_PAGE_SELECT                                    0x00001000 
    371371#define OHCI_ITD_MK_OFFS(len)                                   (0xe000 | ((len) & 0x1fff)) 
    372 #define OHCI_ITD_GET_BUFFER_LENGTH(x)                   ((x) & 0xfff)           // Transfer length 
    373 #define OHCI_ITD_GET_BUFFER_CONDITION_CODE(x)   ((x) >> 12)                     // Condition Code 
     372#define OHCI_ITD_GET_BUFFER_LENGTH(x)                   ((x) & 0xfff) 
     373#define OHCI_ITD_GET_BUFFER_CONDITION_CODE(x)   ((x) >> 12)      
    374374 
    375375#define OHCI_ISOCHRONOUS_TD_ALIGN 32 
     
    379379// -------------------------------- 
    380380 
    381 #define OHCI_NO_ERROR                           0 
    382 #define OHCI_CRC                                        1 
    383 #define OHCI_BIT_STUFFING                       2 
    384 #define OHCI_DATA_TOGGLE_MISMATCH       3 
    385 #define OHCI_STALL                                      4 
    386 #define OHCI_DEVICE_NOT_RESPONDING      5 
    387 #define OHCI_PID_CHECK_FAILURE          6 
    388 #define OHCI_UNEXPECTED_PID                     7 
    389 #define OHCI_DATA_OVERRUN                       8 
    390 #define OHCI_DATA_UNDERRUN                      9 
    391 #define OHCI_BUFFER_OVERRUN                     12 
    392 #define OHCI_BUFFER_UNDERRUN            13 
    393 #define OHCI_NOT_ACCESSED                       15 
     381#define OHCI_NO_ERROR                           0 
     382#define OHCI_CRC                                        1 
     383#define OHCI_BIT_STUFFING                       2 
     384#define OHCI_DATA_TOGGLE_MISMATCH       3 
     385#define OHCI_STALL                                      4 
     386#define OHCI_DEVICE_NOT_RESPONDING      5 
     387#define OHCI_PID_CHECK_FAILURE          6 
     388#define OHCI_UNEXPECTED_PID                     7 
     389#define OHCI_DATA_OVERRUN                       8 
     390#define OHCI_DATA_UNDERRUN                      9 
     391#define OHCI_BUFFER_OVERRUN                     12 
     392#define OHCI_BUFFER_UNDERRUN            13 
     393#define OHCI_NOT_ACCESSED                       15 
    394394 
    395395// -------------------------------- 
     
    398398// -------------------------------- 
    399399 
    400 #define OHCI_ENABLE_POWER_DELAY                 5 
    401 #define OHCI_READ_DESC_DELAY                    5 
     400#define OHCI_ENABLE_POWER_DELAY                 5 
     401#define OHCI_READ_DESC_DELAY                    5 
    402402 
    403403#endif // OHCI_HARD_H