📄 mac.h
字号:
/* sf tlv parameters */ uint32_t sfid; uint16_t cid; uint8_t service_class_name[128]; uint8_t mbs_service;#define MBS_SERVICE_NONE 0#define MBS_SERVICE_SINGLE_BS 1#define MBS_SERVICE_MULTI_BS 2 /* qos parameter set */ uint8_t qos_parameter_set_type; uint8_t traffic_priority; uint32_t maximum_sustained_traffic_rate; uint32_t maximum_traffic_burst; uint32_t minimum_reserved_traffic_rate; uint8_t service_flow_scheduling_type;#define UPLINK_GRANT_SCHEDULING_TYPE_RESERVED 0#define UPLINK_GRANT_SCHEDULING_TYPE_UNDEFINED 1#define UPLINK_GRANT_SCHEDULING_TYPE_BE 2#define UPLINK_GRANT_SCHEDULING_TYPE_NRTPS 3#define UPLINK_GRANT_SCHEDULING_TYPE_RTPS 4#define UPLINK_GRANT_SCHEDULING_TYPE_ERTPS 5#define UPLINK_GRANT_SCHEDULING_TYPE_UGS 6#define UPLINK_GRANT_SCHEDULING_TYPE_SIG 7 uint8_t request_transmission_policy;#define NO_BROADCAST_BANDWIDTH_REQUEST_OPPORTUNITIES 1#define NO_MULTICAST_BANDWIDTH_REQUEST_OPPORTUNITIES 2#define NO_PIGGYBACK_REQUEST_WITH_DATA 4#define NO_FRAGMENT 8#define NO_PHS 16#define NO_PACK_FRAGMENT 32#define NO_CRC 64 uint32_t tolerated_jitter; uint32_t maximum_latency; uint8_t fixed_variable_length_indicator;#define VARIABLE_LENGTH_SDU 0#define FIXED_LENGTH_SDU 1 uint8_t sdu_size; uint16_t target_said; /* arq parameter set */ uint8_t arq_enable; uint16_t arq_window_size; uint16_t arq_retry_timeout_transmitter_delay; uint16_t arq_retry_timeout_receiver_delay; uint16_t arq_block_lifetime; uint16_t arq_sync_loss; uint8_t arq_deliver_in_order; uint16_t arq_purge_timeout; uint16_t arq_block_size; uint8_t cs; uint8_t type_of_data_delivery_services; uint16_t sdu_inter_arrival_interval; /* unit in 0.5ms */ uint16_t time_base; uint8_t paging_preference; uint8_t mbs_zone_identifier_assignment[8]; uint8_t traffic_indication_preference; uint8_t global_service_class_name[6]; uint8_t sn_feedback_enabled; uint8_t fsn_size;#define BIT3_FSN 0#define BIT11_FSN 1 /* cid_allocation_for_active_bs; */ uint16_t unsolicited_grant_interval; /* unit in ms */ uint16_t unsolicited_polling_interval; /* unit in ms */ uint8_t pdu_sn_extended_subheader_for_harq_reordering; /* mbs_contents_id; */ uint8_t harq_service_flows; /* authorization_token; */ /* harq_channel_mapping; */}sfattr_t;typedef struct ssinfo_s{ pthread_mutex_t mutex; struct list_head link; uint32_t stat;#define SS_INVALID 0xffffffff#define SS_RANGING 0#define SS_ACTIVE 1#define SS_HO 2#define SS_SLEEP 3#define SS_IDLE 4 uint32_t substat;#define SS_RNG_ABORT 1 /* intermediate state */#define SS_RNG_CONT 2 /* in this state, only RNG-REQ message can be accepted */#define SS_RNG_SUCC 3 /* in this state, the SBC-REQ message is expected, RNG-REQ will lead the state to SS_RNG_CONT or SS_RNG_SUCC, all other messages shall be discarded */#define SS_REG_SUCC 4#define SS_NOTHING_TODO 0#define SS_RNGREQ_EXPECTING 1#define SS_SBCREQ_EXPECTING 2#define SS_REGREQ_EXPECTING 3 uint8_t mac_addr[6]; uint32_t bwg; /* unit in slot */ uint8_t diuc; uint8_t uiuc; uint8_t nr_sf;/*reder:sf numbers*/ sfattr_t *sf[256];//the maximum support of the sf uint32_t avg_load; uint8_t nr_timer; wxtimer_t *timer[16]; struct list_head dscheded_link; /* at least one downlink service flow of this ss has been scheduled in this frame, * so this ss will be added into a list using this link, but in step one, leave it alone.*/ struct list_head uscheded_link; /* at least one uplink service flow of this ss has been scheduled in this frame, * so this ss will be added into a list using this link */ union { struct list_head ranging_link; struct list_head active_link; struct list_head ho_link; struct list_head sleep_link; struct list_head idle_link; }; /* information from RNG-REQ */ uint8_t req_dl_bp; /* requested downlink burst profile */ uint8_t aas_bc_cap; /* AAS broadcast capability */ uint8_t serv_bsid[6]; /* serving bs id */ uint8_t pg_ctl_id[6]; /* paging controller id */ uint16_t mac_hash_skip_threshold; /* mac hash skip threshold */ uint8_t act_trigger; /* enabled action triggered */ uint8_t req_dl_rep_code_lev; /* requested downlink repetition coding level */ /* .... to be here later */ /* power saving class parameters */ /* information from REG-REQ */ uint8_t ss_mgr_spt; /* ss management support */ uint8_t ip_mgr_mode; /* ip management support */ uint8_t ip_ver; /* ip version */ uint16_t max_ul_cid; /* number of uplink transport CIDs supported */ uint16_t max_dl_cid; /* number of downlink transport CIDs supported */ uint32_t cs_cap; /* classification/phs options and SDU encapsulation support */ uint16_t max_cls; /* maximum number of classifiers */ uint8_t phs_spt; /* phs support */ uint8_t arq_spt; /* arq support */ uint8_t dsx_flow_ctrl; /* DSx flow control */ uint8_t mca_flow_ctrl; /* mca flow control */ uint8_t mc_polling_grp_cid_spt; /* multicast polling group cid support */ uint8_t packing_spt; /* packing support */ uint8_t ext_rtps_spt; /* mac extended rtPS support */ uint8_t max_num_bursts; /* maximum number of bursts transmitted concurrently to the MS */ uint8_t alloc_ip_mode; /* method for allocating IP address for the secondary management connection */ uint8_t ho_spt; /* handover supported */}ssinfo_t;#define WAIT_FOR_DCD 1#define WAIT_FOR_BROADCAST 2/*typedef enum { }SS_STAT_ENUM;*//* we just pre-define the number of bytes that one slot can * contail, for simplicity. */#define BITS_PER_SUBCARRIER_QPSK 2#define BITS_PER_SUBCARRIER_16QAM 4#define BITS_PER_SUBCARRIER_64QAM 6#define BYTES_PER_SLOT_QPSK_12 6#define BYTES_PER_SLOT_QPSK_34 9#define BYTES_PER_SLOT_16QAM_12 12#define BYTES_PER_SLOT_16QAM_34 18#define BYTES_PER_SLOT_64QAM_12 18#define BYTES_PER_SLOT_64QAM_23 24#define BYTES_PER_SLOT_64QAM_34 27#define BYTES_PER_SLOT_64QAM_56 30typedef enum FEC_MODULATION_TYPE{ _QPSK_CC_12 = 0, /* y */ _QPSK_CC_34, /* y */ _16QAM_CC_12, /* y */ _16QAM_CC_34, /* y */ _64QAM_CC_12, /* y */ _64QAM_CC_23 = 5, /* y */ _64QAM_CC_34, /* y */ _QPSK_BTC_12, _QPSK_BTC_34, _16QAM_BTC_35, _16QAM_BTC_45 = 10, _64QAM_BTC_58, _64QAM_BTC_45, _QPSK_CTC_12 = 13, /* y */ _QPSK_CTC_34 = 15, /* y */ _16QAM_CTC_12, /* y */ _16QAM_CTC_34, /* y */ _64QAM_CTC_12, /* y */ _64QAM_CTC_23, /* y */ _64QAM_CTC_34 = 20, /* y */ _64QAM_CTC_56, /* y */ _QPSK_ZTCC_12, _QPSK_ZTCC_34, _16QAM_ZTCC_12, _16QAM_ZTCC_34 = 25, _64QAM_ZTCC_12, _64QAM_ZTCC_23, _64QAM_ZTCC_34, /* etc. */ FEC_MODULATION_TYPE_BOTTOM}FEC_MODULATION_TYPE_ENUM;typedef struct bsinfo_s{ pthread_mutex_t mutex; uint32_t total_load; wxtimer_t *timer[16]; /* BS config info, may got from BS configuration file, * if no configuration file, use macro definitions. */ uint8_t power_adjustment_rule; uint8_t channel_nr; uint16_t ttg; uint8_t rtg; uint16_t rss_ir_max; uint32_t channel_switch_frame_number; /* 24-bit */ uint32_t frequency; uint8_t mac_addr[6]; uint8_t frame_duration_code; uint32_t frame; /* 24-bit */#define FRAME_LENGTH 5 /* unit in ms */ uint8_t harq_ack_delay_for_dl_burst; uint8_t permutation_type_for_broadcast_region_in_harq_zone; uint8_t maximum_retransmission; uint8_t mac_version; uint8_t ranging_backoff_start; uint8_t ranging_backoff_end; uint8_t request_backoff_start; uint8_t request_backoff_end; uint8_t initial_ranging_codes; uint8_t periodic_ranging_codes; uint8_t bandwidth_request_codes; uint8_t periodic_ranging_backoff_start; uint8_t periodic_ranging_backoff_end; uint8_t start_of_ranging_codes_group; uint8_t permutation_base; struct burstpf_set{ uint8_t count[2];//count[0]:DCD_count,count[1]:UCD_count uint8_t nr; uint8_t code[16]; uint8_t xiuc_fec[2][16]; uint8_t ranging_data_ratio[16]; /* uplink only */ uint8_t diuc_mandatory_exit_threshold[16]; /* downlink only */ uint8_t diuc_minimum_entry_threshold[16]; /* downlink only */ uint32_t frequency[16]; /* downlink only */ }set[2]; struct burstpf_set *bp_active; struct burstpf_set *bp_expired; uint32_t allocation_start_time; uint8_t dl_sym_slot; uint8_t ul_sym_slot;#define DL_SYMBOLS_PER_SLOT 2#define UL_SYMBOLS_PER_SLOT 3 uint16_t nr_dlsymbol; uint16_t nr_ulsymbol; uint32_t dcd_interval; /* time between transmission of DCD message. */ uint32_t ucd_interval; /* time between transmission of UCD message. */ uint32_t ucd_transition; /* time the BS shall wait after repeating a UCD * message with an incremented configuration change * count before issuing a UL-MAP message referring * to uplink_burst_profile defined in that UCD message */ uint32_t dcd_transition; uint32_t initial_ranging_interval; /* time between initial ranging regions assigned by the BS */ uint32_t clk_cmp_interval; uint32_t invited_ranging_retries; /* number of retries on inviting ranging requests */ uint32_t t_proc; uint32_t ss_ranging_response_processing_time; /* time allowed for an SS following receipt of a ranging * response before it is expected to reply to an invited ranging request */ uint32_t dsx_request_retries; /* number of timeout retries on DSA/DSC/DSD requests */ uint32_t dsx_response_retries; uint32_t ranging_correction_retries; uint32_t t5; /* wait for uplink channel change response */ uint32_t t7; /* wait for DSA/DSC/DSD response timeout */ uint32_t t8; /* wait fo DSA/DSC acknowledge timeout */ uint32_t t9; /* registration timeout, the time allowed betwwen * the BS sending a RNG-RSP(success) to an SS, * and receiving a SBC-REQ from that same SS. */ uint32_t t10; /* wait for transaction end timieout */ uint32_t t13; /* time allowed for a ss following receipt of a * REG-RSP message to send a TFTP-CPLT message to the BS */ uint32_t t15; /* wait for MCA-RSP */ uint32_t t17; /* time allowed for ss to complete ss authorization * and key exchange */ uint32_t t22; /* wait for ARQ-Reset */ uint32_t t27_idle; /* maximum time between unicat grants to SS when * BS believes SS uplink transmission quality is * good enough */ uint32_t t27_active; /* maximum time between unicast grants to SS when * BS believes SS uplink transmission quality is * not good enough */ uint32_t mob_nbr_adv_interval; /* nominal time between transmission of MOB-NBR-ADV messages. */ uint32_t asc_aging_timer; /* nominal time for aging of MS asoociations */ uint32_t paging_retries; /* number of retries on paging transmission. If the * BS doesnot receive RNG-REQ from the MSS until this * value decrease to zero, it determines that the MS * is unavailable. */ uint32_t mode_selection_feedback_processing_time;/* time allowed between the end of the burst carrying * the mode selection feedback subheader and the start * of the ul-subframe carrying the mode selection feedback response. */ uint32_t idle_mode_system_timer; /* for BS acting as paging controller, timed interval * to receive notification of MS idle mode location update. * Set timer to MS idle mode timeout. TImer recycles on * successful idle mode location update. */ uint32_t nr_ranging; uint32_t nr_active; uint32_t nr_ho; uint32_t nr_sleep; uint32_t nr_idle; struct list_head ss_que[5];}bsinfo_t;/* all the time values are in unit of `ms'. * all the retry values are in unit of `frame'. */#define DCD_INTERVAL_MAX 10000#define UCD_INTERVAL_MAX 10000#define UCD_TRANSMISSION_MIN 20#define DCD_TRANSMISSION_MIN 20#define INITIAL_RANGING_INTERVAL_MAX 2000#define CLK_CMP_INTERVAL_MIN 50#define CLK_CMP_INTERVAL_DEF 50#define CLK_CMP_INTERVAL_MAX 50 #define INVITED_RANGING_RETRIES_MIN 16#define T_PROC_MIN 10 * FRAME_LENGTH#define SS_RANGING_RESPONSE_PROCESSING_TIME_MIN 10#define DSX_REQUEST_RETRIES_DEF 3#define DSX_RESPONSE_RETRIES_DEF 3#define RANGING_CORRECTION_RETRIES_DEF 16#define T5_MAX 2000#define T7_MAX 1000#define T8_MAX 300#define T9_MIN 300#define T9_DEF 300#define T10_MAX 3000#define T13_MIN 900000#define T13_DEF 900000#define T15_MIN 20#define T15_DEF 20#define T17_MIN 300000#define T17_DEF 300000#define T22_MAX 500#define T27_IDLE_MIN#define T27_ACTIVE_MIN#define MOB_NBR_ADV_INTERVAL_MAX 30000#define ASC_AGING_TIMER_MIN 100#define ASC_AGING_TIMER_MAX 10000#define PAGING_RETRIES_DEF 3#define PAGING_RETRIES_MAX 16#define MODE_SELECTION_FEEDBACK_PROCESSING_TIME_MIN FRAME_LENGTH#define IDLE_MODE_SYSTEM_TIMER_MIN 128000#define IDLE_MODE_SYSTEM_TIMER_DEF 4096000#define IDLE_MODE_SYSTEM_TIMER_MAX 65536000#define is_basic_cid(cid) ( cid >= 1 && cid <= 256 )#define is_primary_cid(cid) ( cid >= 256+1 && cid <= 256+256 )#define MAX_SS_NUM 256#define MAX_SF_NUM 65536extern bsinfo_t g_bsinfo;extern ssinfo_t g_ssinfo[MAX_SS_NUM];extern sfattr_t g_serviceflow[MAX_SF_NUM];extern softq_t g_softque[MAX_SF_NUM];extern int32_t mac_init();extern int32_t is_fcfsn_valid(int8_t ofc, int16_t ofsn, int8_t nfc, int16_t nfsn, int8_t ext);extern uint32_t bytes_perslot(uint8_t xiuc, uint8_t doru);extern int32_t alloc_ss();extern void release_ss(ssinfo_t *ss);extern int32_t sf_active(uint16_t cid);#endif /* _MAC_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -