Changeset 8a64320e in mainline for uspace/drv/nic/ar9271/htc.h


Ignore:
Timestamp:
2015-04-23T23:40:14Z (10 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
dcba819
Parents:
09044cb
Message:

pre-merge coding style cleanup and code review

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/nic/ar9271/htc.h

    r09044cb r8a64320e  
    2929/** @file htc.h
    3030 *
    31  * Definitions of the Atheros HTC (Host Target Communication) technology 
     31 * Definitions of the Atheros HTC (Host Target Communication) technology
    3232 * for communication between host (PC) and target (device firmware).
    3333 *
     
    3535
    3636#ifndef ATHEROS_HTC_H
    37 #define ATHEROS_HTC_H
     37#define ATHEROS_HTC_H
    3838
    3939#include <ieee80211.h>
     
    4141#include <sys/types.h>
    4242#include <nic.h>
    43 
    4443#include "ath.h"
    4544
    46 #define HTC_RTS_THRESHOLD 2304
    47 #define HTC_RATES_MAX_LENGTH 30
    48 
    49 /**
    50  * HTC message IDs.
     45#define HTC_RTS_THRESHOLD     2304
     46#define HTC_RATES_MAX_LENGTH  30
     47
     48/** HTC message IDs.
     49 *
    5150 */
    5251typedef enum {
    5352        HTC_MESSAGE_READY = 1,
    5453        HTC_MESSAGE_CONNECT_SERVICE,
    55         HTC_MESSAGE_CONNECT_SERVICE_RESPONSE,
    56         HTC_MESSAGE_SETUP_COMPLETE,
    57         HTC_MESSAGE_CONFIG
     54        HTC_MESSAGE_CONNECT_SERVICE_RESPONSE,
     55        HTC_MESSAGE_SETUP_COMPLETE,
     56        HTC_MESSAGE_CONFIG
    5857} htc_message_id_t;
    5958
    60 /**
    61  * HTC response message status codes.
     59/** HTC response message status codes.
     60 *
    6261 */
    6362typedef enum {
    64         HTC_SERVICE_SUCCESS = 0,
    65         HTC_SERVICE_NOT_FOUND,
    66         HTC_SERVICE_FAILED,
    67         HTC_SERVICE_NO_RESOURCES,
    68         HTC_SERVICE_NO_MORE_EP
     63        HTC_SERVICE_SUCCESS = 0,
     64        HTC_SERVICE_NOT_FOUND,
     65        HTC_SERVICE_FAILED,
     66        HTC_SERVICE_NO_RESOURCES,
     67        HTC_SERVICE_NO_MORE_EP
    6968} htc_response_status_code_t;
    7069
    71 /**
    72  * HTC operating mode definition.
     70/** HTC operating mode definition.
     71 *
    7372 */
    7473typedef enum {
     
    7978} htc_operating_mode_t;
    8079
    81 /**
    82  * HTC data type indicator.
     80/** HTC data type indicator.
     81 *
    8382 */
    8483typedef enum {
     
    8988} htc_data_type_t;
    9089
    91 /**
    92  * HTC endpoint numbers.
    93  */
    94 typedef struct {
    95         int ctrl_endpoint;
     90/** HTC endpoint numbers.
     91 *
     92 */
     93typedef struct {
     94        int ctrl_endpoint;
    9695        int wmi_endpoint;
    9796        int beacon_endpoint;
     
    105104} htc_pipes_t;
    106105
    107 /**
    108  * HTC device data.
    109  */
    110 typedef struct {
    111         /** WMI message sequence number */
    112         uint16_t sequence_number;
    113    
     106/** HTC device data.
     107 *
     108 */
     109typedef struct {
     110        /** WMI message sequence number */
     111        uint16_t sequence_number;
     112       
    114113        /** HTC endpoints numbers */
    115114        htc_pipes_t endpoints;
     
    128127} htc_device_t;
    129128
    130 /**
    131  * HTC frame header structure.
    132  */
    133 typedef struct {
    134         uint8_t   endpoint_id;
    135         uint8_t   flags;
    136         uint16_t  payload_length;       /**< Big Endian value! */
    137         uint8_t   control_bytes[4];
     129/** HTC frame header structure.
     130 *
     131 */
     132typedef struct {
     133        uint8_t endpoint_id;
     134        uint8_t flags;
     135        uint16_t payload_length;   /**< Big Endian value! */
     136        uint8_t control_bytes[4];
    138137} __attribute__((packed)) htc_frame_header_t;
    139138
    140 /**
    141  * HTC management TX frame header structure.
     139/** HTC management TX frame header structure.
     140 *
    142141 */
    143142typedef struct {
     
    152151} __attribute__((packed)) htc_tx_management_header_t;
    153152
    154 /**
    155  * HTC data TX frame header structure.
     153/** HTC data TX frame header structure.
     154 *
    156155 */
    157156typedef struct {
     
    160159        uint8_t vif_idx;
    161160        uint8_t tidno;
    162         uint32_t flags;                 /**< Big Endian value! */
     161        uint32_t flags;    /**< Big Endian value! */
    163162        uint8_t key_type;
    164163        uint8_t keyix;
     
    167166} __attribute__((packed)) htc_tx_data_header_t;
    168167
    169 /**
    170  * HTC ready message structure.
    171  */
    172 typedef struct {
    173         uint16_t message_id;            /**< Big Endian value! */
    174         uint16_t credits;               /**< Big Endian value! */
    175         uint16_t credit_size;           /**< Big Endian value! */
    176        
    177         uint8_t max_endpoints;
     168/** HTC ready message structure.
     169 *
     170 */
     171typedef struct {
     172        uint16_t message_id;   /**< Big Endian value! */
     173        uint16_t credits;      /**< Big Endian value! */
     174        uint16_t credit_size;  /**< Big Endian value! */
     175       
     176        uint8_t max_endpoints;
    178177        uint8_t pad;
    179178} __attribute__((packed)) htc_ready_msg_t;
    180179
    181 /**
    182  * HTC service message structure.
    183  */
    184 typedef struct {
    185         uint16_t message_id;            /**< Big Endian value! */
    186         uint16_t service_id;            /**< Big Endian value! */
    187         uint16_t connection_flags;      /**< Big Endian value! */
     180/** HTC service message structure.
     181 *
     182 */
     183typedef struct {
     184        uint16_t message_id;        /**< Big Endian value! */
     185        uint16_t service_id;        /**< Big Endian value! */
     186        uint16_t connection_flags;  /**< Big Endian value! */
    188187       
    189188        uint8_t download_pipe_id;
     
    193192} __attribute__((packed)) htc_service_msg_t;
    194193
    195 /**
    196  * HTC service response message structure.
    197  */
    198 typedef struct {
    199         uint16_t message_id;            /**< Big Endian value! */
    200         uint16_t service_id;            /**< Big Endian value! */
    201         uint8_t status;
    202         uint8_t endpoint_id;
    203         uint16_t max_message_length;    /**< Big Endian value! */
    204         uint8_t service_meta_length;
    205         uint8_t pad;
     194/** HTC service response message structure.
     195 *
     196 */
     197typedef struct {
     198        uint16_t message_id;          /**< Big Endian value! */
     199        uint16_t service_id;          /**< Big Endian value! */
     200        uint8_t status;
     201        uint8_t endpoint_id;
     202        uint16_t max_message_length;  /**< Big Endian value! */
     203        uint8_t service_meta_length;
     204        uint8_t pad;
    206205} __attribute__((packed)) htc_service_resp_msg_t;
    207206
    208 /**
    209  * HTC credits config message structure.
    210  */
    211 typedef struct {
    212         uint16_t message_id;            /**< Big Endian value! */
    213         uint8_t pipe_id;
    214         uint8_t credits;
     207/** HTC credits config message structure.
     208 *
     209 */
     210typedef struct {
     211        uint16_t message_id;  /**< Big Endian value! */
     212        uint8_t pipe_id;
     213        uint8_t credits;
    215214} __attribute__((packed)) htc_config_msg_t;
    216215
    217 /**
    218  * HTC new virtual interface message.
    219  */
    220 typedef struct {
    221         uint8_t index;
     216/** HTC new virtual interface message.
     217 *
     218 */
     219typedef struct {
     220        uint8_t index;
    222221        uint8_t op_mode;
    223222        uint8_t addr[ETH_ADDR];
    224223        uint8_t ath_cap;
    225         uint16_t rts_thres;             /**< Big Endian value! */
     224        uint16_t rts_thres;      /**< Big Endian value! */
    226225        uint8_t pad;
    227226} __attribute__((packed)) htc_vif_msg_t;
    228227
    229 /**
    230  * HTC new station message.
     228/** HTC new station message.
     229 *
    231230 */
    232231typedef struct {
    233232        uint8_t addr[ETH_ADDR];
    234233        uint8_t bssid[ETH_ADDR];
    235         uint8_t sta_index;
     234        uint8_t sta_index;
    236235        uint8_t vif_index;
    237236        uint8_t is_vif_sta;
    238                
    239         uint16_t flags;         /**< Big Endian value! */
    240         uint16_t ht_cap;        /**< Big Endian value! */
    241         uint16_t max_ampdu;     /**< Big Endian value! */
     237       
     238        uint16_t flags;      /**< Big Endian value! */
     239        uint16_t ht_cap;     /**< Big Endian value! */
     240        uint16_t max_ampdu;  /**< Big Endian value! */
    242241       
    243242        uint8_t pad;
    244243} __attribute__((packed)) htc_sta_msg_t;
    245244
    246 /**
    247  * HTC message to inform target about available capabilities.
    248  */
    249 typedef struct {
    250         uint32_t ampdu_limit;   /**< Big Endian value! */
     245/** HTC message to inform target about available capabilities.
     246 *
     247 */
     248typedef struct {
     249        uint32_t ampdu_limit;     /**< Big Endian value! */
    251250        uint8_t ampdu_subframes;
    252251        uint8_t enable_coex;
     
    258257        uint8_t sta_index;
    259258        uint8_t is_new;
    260         uint32_t cap_flags;     /**< Big Endian value! */
     259        uint32_t cap_flags;  /**< Big Endian value! */
    261260        uint8_t legacy_rates_count;
    262261        uint8_t legacy_rates[HTC_RATES_MAX_LENGTH];
     
    264263} htc_rate_msg_t;
    265264
    266 /**
    267  * HTC RX status structure used in incoming HTC data messages.
    268  */
    269 typedef struct {
    270         uint64_t timestamp;     /**< Big Endian value! */
    271         uint16_t data_length;   /**< Big Endian value! */
     265/** HTC RX status structure used in incoming HTC data messages.
     266 *
     267 */
     268typedef struct {
     269        uint64_t timestamp;    /**< Big Endian value! */
     270        uint16_t data_length;  /**< Big Endian value! */
    272271        uint8_t status;
    273272        uint8_t phy_err;
     
    284283        uint8_t flags;
    285284        uint8_t dummy;
    286         uint32_t evm0;          /**< Big Endian value! */
    287         uint32_t evm1;          /**< Big Endian value! */
    288         uint32_t evm2;          /**< Big Endian value! */
     285        uint32_t evm0;         /**< Big Endian value! */
     286        uint32_t evm1;         /**< Big Endian value! */
     287        uint32_t evm2;         /**< Big Endian value! */
    289288} htc_rx_status_t;
    290289
    291 /**
    292  * HTC setup complete message structure
    293  */
    294 typedef struct {
    295         uint16_t message_id;            /**< Big Endian value! */
     290/** HTC setup complete message structure
     291 *
     292 */
     293typedef struct {
     294        uint16_t message_id;  /**< Big Endian value! */
    296295} __attribute__((packed)) htc_setup_complete_msg_t;
    297296
    298 extern int htc_device_init(ath_t *ath_device, ieee80211_dev_t *ieee80211_dev,
    299         htc_device_t *htc_device);
    300 extern int htc_init(htc_device_t *htc_device);
    301 extern int htc_init_new_vif(htc_device_t *htc_device);
    302 extern int htc_read_control_message(htc_device_t *htc_device, void *buffer,
    303         size_t buffer_size, size_t *transferred_size);
    304 extern int htc_read_data_message(htc_device_t *htc_device, void *buffer,
    305         size_t buffer_size, size_t *transferred_size);
    306 extern int htc_send_control_message(htc_device_t *htc_device, void *buffer,
    307         size_t buffer_size, uint8_t endpoint_id);
    308 extern int htc_send_data_message(htc_device_t *htc_device, void *buffer,
    309         size_t buffer_size, uint8_t endpoint_id);
    310 
    311 #endif  /* ATHEROS_HTC_H */
    312 
     297extern int htc_device_init(ath_t *, ieee80211_dev_t *, htc_device_t *);
     298extern int htc_init(htc_device_t *);
     299extern int htc_init_new_vif(htc_device_t *);
     300extern int htc_read_control_message(htc_device_t *, void *, size_t, size_t *);
     301extern int htc_read_data_message(htc_device_t *, void *, size_t, size_t *);
     302extern int htc_send_control_message(htc_device_t *, void *, size_t, uint8_t);
     303extern int htc_send_data_message(htc_device_t *, void *, size_t, uint8_t);
     304
     305#endif  /* ATHEROS_HTC_H */
Note: See TracChangeset for help on using the changeset viewer.