MAC Layer Reference Implementation
[OpenAirInterface Reference Implementation]


Data Structures

struct  DL_SACCH_FB
 Downlink SACCH Feedback Information. More...
struct  DL_SACCH_PDU
 Dowlink Allocation information for frame. More...
struct  UL_ALLOC_PDU
 Uplink Allocation information for user. More...
struct  CHBCH_PDU
 CHBCH PDU Primitive. This data structure reflects the DL control-plane traffic for the current miniframe. More...
struct  MRBCH_PDU
 MRBCH PDU Primitive. This data structure reflects the MRBCH payload. More...
struct  RACH_PDU
 RACH PDU Primitive. This data structure reflects the UL RACH payload. More...
struct  UL_SACCH_FB
 Uplink SACCH Feedback Information. More...
struct  UL_RACH_FB
 Uplink RACH Feedback Information. More...
struct  UL_SACCH_PDU
 Uplink SACCH PDU Structure. More...
struct  DL_SACH_PDU
 Downlink SACH PDU Structure. More...
struct  UL_SACH_PDU
 Uplink SACH PDU Structure. More...
struct  DL_MEAS
 Downlink PHY measurement structure. More...
struct  UL_MEAS
 Uplink PHY measurement structure. More...
struct  LCHAN_INFO
struct  LCHAN_INFO_DIL
struct  LCHAN_INFO_TABLE_ENTRY
struct  LCHAN_INFO_DIL_TABLE_ENTRY
struct  RX_SCHED
struct  TX_OPS
struct  CH_MAC_INST
struct  UE_MAC_INST

Defines

#define TB_SIZE_MAX   52
#define NB_TB_BUFF_MAX   255
#define NUMBER_DL_SACH_MAX   6
#define NUMBER_UL_SACH_MAX   6
#define BCCH_PAYLOAD_SIZE_MAX   18
#define CCCH_PAYLOAD_SIZE_MAX   30
#define NB_DL_SCHED_MAX   NUMBER_DL_SACH_MAX
#define NB_UL_SCHED_MAX   NUMBER_UL_SACH_MAX
#define SACH_PAYLOAD_SIZE_MAX   (TB_SIZE_MAX * NB_TB_BUFF_MAX)
#define RACH_PAYLOAD_SIZE_MAX   20
#define MRBCH_PAYLOAD_SIZE_MAX   20
#define NB_RACH_MAX   2
#define DUMMY_BCCH_SIZE_BYTES   40
#define DUMMY_CCCH_SIZE_BYTES   40
#define DUMMY_RACH_SIZE_BYTES   16
#define NB_TIME_ALLOC   4
#define CHBCH_TIME_ALLOC   0
#define DL_TIME_ALLOC   0x35
#define UL_TIME_ALLOC   0x25
#define BCCH   0
#define CCCH   1
#define DCCH   2
#define DTCH_BD   3
#define DTCH   4
#define DTCH_OFFSET   DTCH+NB_RAB_MAX
#define DTCH_DIL   5
#define RX   0
#define TX   1
#define NB_CH_MAX   8
#define LCHAN_IDLE   0
#define MAC_SCHED_TX   1
#define MAC_TX_READY   2
#define MAC_TX_DONE   3
#define MAC_TX_OK   4
#define MAC_SCHED_RX_REQ   5
#define MAC_SCHED_RX_READY   6
#define MAC_SCHED_RX_OK   7
#define MAC_RX_READY   8
#define MAC_RX_OK   9
#define NUMBER_HARQ_PROCESS_MAX   32
#define MAX_NUMBER_TB_PER_LCHAN   32
#define NUMBER_OF_MEASUREMENT_SUBBANDS   16
#define MAX_NB_SCHED   NUMBER_OF_FREQUENCY_GROUPS
#define USEFUL_CARRIER_OFFSET_dB   2
#define w3g4free_mac_print(level, fmt, args)   {if (level > DEBUG_THRESHOLD) msg(fmt,args); }
#define LCHAN_PAYLOAD_MAX   (TB_SIZE_MAX * NB_TB_BUFF_MAX)
#define NB_REQ_MAX   16
#define SCH_OFFSET   0x3f
#define SCH_SHIFT   2
#define SINR_THRES0   (-3)
#define SINR_THRES1   (0)
#define SINR_THRES2   (3)
#define LCHAN_INFO_SIZE   sizeof(LCHAN_INFO)
#define LCHAN_INFO_DIL_SIZE   sizeof(LCHAN_INFO_DIL)
#define LCHAN_INFO_TABLE_ENTRY_SIZE   sizeof(LCHAN_INFO_TABLE_ENTRY)
#define LCHAN_INFO_DIL_TABLE_ENTRY_SIZE   sizeof(LCHAN_INFO_DIL_TABLE_ENTRY)

Functions

void chbch_phy_sync_success (unsigned char Mod_id, unsigned char CH_index)
void mrbch_phy_sync_failure (unsigned char Mod_id, unsigned char Free_ch_index)
int mac_top_init (void)
char layer2_init_mr (unsigned char Mod_id)
char layer2_init_ch (unsigned char Mod_id, unsigned char Free_ch_index)
void mac_switch_node_function (unsigned char Mod_id)
int mac_init_global_param (void)
void mac_top_cleanup (unsigned char Mod_id)
void mac_UE_out_of_sync_ind (unsigned char Mod_id, unsigned short CH_index)
void nodeb_mac_scheduler_tx (unsigned char Mod_id)
void nodeb_mac_scheduler_rx (unsigned char Mod_id)
void ue_mac_scheduler_tx (unsigned char Mod_id)
void ue_mac_scheduler_rx (unsigned char Mod_id)
void nodeb_generate_chbch (unsigned char)
 This routine first retrieves the BCCH and CCCH logical channels from RRC. It then fills the UL and DL allocation maps as well as feedback channels in a CHBCH_PDU structure. Finally it generates a MACPHY_DATA_REQ for the PHY CHBCH transmitter.
void ch_fill_dil_map (unsigned char Mod_id, LCHAN_INFO_DIL_TABLE_ENTRY *Lchan_entry)
 This routine fills the CHBCH_PDU entries corresponding to a particular direct link logical channel.
void ch_fill_dl_map (unsigned char Mod_id, LCHAN_INFO_TABLE_ENTRY *Lchan_entry)
 This routine fills the CHBCH_PDU entries corresponding to a particular downlink logical channel.
void ch_fill_ul_map (unsigned char Mod_id, LCHAN_INFO_TABLE_ENTRY *Lchan_entry)
 This routine fills the CHBCH_PDU entries corresponding to a particular uplink logical channel. It operates in TTI $N-1$ and prepares a CHBCH_PDU which will be on-air in TTI $N$. Furthermore, the UL_MAP is used to schedule the RX resources (UL-SACH) for TTI $N+1$.
void nodeb_scheduler (unsigned char Mod_id)
 This routine is the top-level entry point for NodeB physical resource scheduling. It performs downlink, uplink and direct link scheduling for the next TTI based on measurement feedback (RF and traffic) from nodes and local measurements.
void nodeb_get_sach (unsigned char Mod_id)
 This routine generates a MACPHY_DATA_REQs in order to program NodeB PHY to receive a SACH and corresponding SCH. This is invoked in TTI $N-1$ for action in TTI $N$. The result is seen by NodeB MAC in TTI $N+1$.
void nodeb_decode_sch (unsigned char Mod_id, UL_MEAS *UL_meas, unsigned short Index)
 This routine extracts the PHY measurements received from an SCH channel.
void nodeb_process_sacch (unsigned char Mod_id, LCHAN_INFO_TABLE_ENTRY *Lchan_entry, unsigned char Lchan_index, unsigned char User_index, UL_SACCH_PDU *Sacch_pdu)
void nodeb_decode_sach (unsigned char Mod_id, UL_SACH_PDU *Sach_pdu, UL_MEAS *UL_meas, unsigned short Lchan_id_index, int *crc_status)
 This routine extracts the UL_SACCH information. It does nothing for the moment.
void nodeb_get_rach (unsigned char Mod_id, unsigned char nb_rach)
 This routine generates a MACPHY_DATA_REQ in order to program NodeB PHY to receive a set of RACH. This is invoked in TTI $N-1$ for action in TTI $N$. The result is seen by NodeB MAC in TTI $N+1$.
void nodeb_decode_rach (unsigned char Mod_id, RACH_PDU *Rach_pdu)
 This routine extracts the UL_SACCH information. It does nothing for the moment.
void nodeb_generate_sach (unsigned char Mod_id)
 This routine first retrieves the maps as well as feedback channels in a CHBCH_PDU structure. Finally it generates a MACPHY_DATA_REQ for the PHY DL_SACH transmitter.
void schedule_dcch (unsigned char Mod_id, unsigned char User, unsigned short *Freq_alloc_map, unsigned char *User_alloc_map, unsigned short rb_map)
 This routine is used by the NodeB scheduler to allocate resources for dcch channels.
void ue_process_DL_meas (unsigned char Mod_id, unsigned short CH_index)
void ue_get_chbch (unsigned char Mod_id, unsigned char CH_index)
 This routine generates a MACPHY_DATA_REQ in order to program UE PHY to receive a CHBCH. This is invoked in TTI $N-1$ for action in TTI $N$. The result is seen by UE MAC in TTI $N+1$.
void ue_decode_chbch (unsigned char Mod_id, CHBCH_PDU *Chbch_pdu, DL_MEAS *DL_meas, unsigned short Index, int crc_status)
void ue_complete_dl_data_req (unsigned char Mod_id)
void ue_get_dil_sach (u8 Mod_id)
void mac_check_rlc_queues_status (unsigned char, unsigned char, UL_SACCH_FB *)
void ue_fill_macphy_data_req (unsigned char, LCHAN_INFO_TABLE_ENTRY *, unsigned char)
void ue_decode_sch (unsigned char Mod_id, UL_MEAS *UL_meas, unsigned short Index)
void ue_decode_sach (unsigned char, DL_SACH_PDU *, UL_MEAS *UL_meas, unsigned short, int *crc_status)
void ue_generate_rach (unsigned char, unsigned char)
void ue_generate_sach (unsigned char)
void ue_scheduler (unsigned char, unsigned char)
int clear_lchan_table (LCHAN_INFO_TABLE_ENTRY *Table, unsigned char Dim)
unsigned short mac_config_req (unsigned char Mod_id, unsigned char Action, MAC_CONFIG_REQ *Req)
unsigned short ch_mac_config_req (unsigned char Mod_id, unsigned char Action, MAC_CONFIG_REQ *Req)
unsigned short ue_mac_config_req (unsigned char Mod_id, unsigned char Action, MAC_CONFIG_REQ *Req)
MAC_MEAS_REQ_ENTRYmac_meas_req (unsigned char Mod_id, MAC_MEAS_REQ *Meas_req)
MAC_MEAS_REQ_ENTRYch_mac_meas_req (unsigned char Mod_id, MAC_MEAS_REQ *Meas_req)
MAC_MEAS_REQ_ENTRYue_mac_meas_req (unsigned char Mod_id, MAC_MEAS_REQ *Meas_req)
void mac_update_meas (unsigned char Mod_id, MAC_MEAS_REQ_ENTRY *Meas_entry, UL_MEAS *UL_meas)
unsigned char mac_check_meas_trigger (MAC_MEAS_REQ *Meas_req)
unsigned char mac_check_meas_ind (MAC_MEAS_REQ_ENTRY *Meas_entry)
int add_openair2_stats (void)
 This routine initialized the openair2 /proc/openair2 entry.
char * print_cqi (unsigned int cqi)
 This routine prints the CQI information.
void copy_phy_resources (PHY_RESOURCES *To, PHY_RESOURCES *From)
void macphy_scheduler (unsigned char last_slot)
void swap (char *Array, char a, char b)
char partition (char *a, char *, char low, char high)
void quicksort (char *a, char *b, char low, char high)
void q_sort (char low, char high)


Define Documentation

#define TB_SIZE_MAX   52

#define NB_TB_BUFF_MAX   255

#define NUMBER_DL_SACH_MAX   6

#define NUMBER_UL_SACH_MAX   6

#define BCCH_PAYLOAD_SIZE_MAX   18

#define CCCH_PAYLOAD_SIZE_MAX   30

#define NB_DL_SCHED_MAX   NUMBER_DL_SACH_MAX

#define NB_UL_SCHED_MAX   NUMBER_UL_SACH_MAX

#define SACH_PAYLOAD_SIZE_MAX   (TB_SIZE_MAX * NB_TB_BUFF_MAX)

#define RACH_PAYLOAD_SIZE_MAX   20

#define MRBCH_PAYLOAD_SIZE_MAX   20

#define NB_RACH_MAX   2

#define DUMMY_BCCH_SIZE_BYTES   40

#define DUMMY_CCCH_SIZE_BYTES   40

#define DUMMY_RACH_SIZE_BYTES   16

#define NB_TIME_ALLOC   4

#define CHBCH_TIME_ALLOC   0

#define DL_TIME_ALLOC   0x35

#define UL_TIME_ALLOC   0x25

#define BCCH   0

#define CCCH   1

#define DCCH   2

#define DTCH_BD   3

#define DTCH   4

#define DTCH_OFFSET   DTCH+NB_RAB_MAX

#define DTCH_DIL   5

#define RX   0

#define TX   1

#define NB_CH_MAX   8

#define LCHAN_IDLE   0

#define MAC_SCHED_TX   1

#define MAC_TX_READY   2

#define MAC_TX_DONE   3

#define MAC_TX_OK   4

#define MAC_SCHED_RX_REQ   5

#define MAC_SCHED_RX_READY   6

#define MAC_SCHED_RX_OK   7

#define MAC_RX_READY   8

#define MAC_RX_OK   9

#define NUMBER_HARQ_PROCESS_MAX   32

#define MAX_NUMBER_TB_PER_LCHAN   32

#define NUMBER_OF_MEASUREMENT_SUBBANDS   16

#define MAX_NB_SCHED   NUMBER_OF_FREQUENCY_GROUPS

#define USEFUL_CARRIER_OFFSET_dB   2

#define w3g4free_mac_print ( level,
fmt,
args   )     {if (level > DEBUG_THRESHOLD) msg(fmt,args); }

#define LCHAN_PAYLOAD_MAX   (TB_SIZE_MAX * NB_TB_BUFF_MAX)

#define NB_REQ_MAX   16

#define SCH_OFFSET   0x3f

#define SCH_SHIFT   2

#define SINR_THRES0   (-3)

#define SINR_THRES1   (0)

#define SINR_THRES2   (3)

#define LCHAN_INFO_SIZE   sizeof(LCHAN_INFO)

#define LCHAN_INFO_DIL_SIZE   sizeof(LCHAN_INFO_DIL)

#define LCHAN_INFO_TABLE_ENTRY_SIZE   sizeof(LCHAN_INFO_TABLE_ENTRY)

#define LCHAN_INFO_DIL_TABLE_ENTRY_SIZE   sizeof(LCHAN_INFO_DIL_TABLE_ENTRY)


Function Documentation

void chbch_phy_sync_success ( unsigned char  Mod_id,
unsigned char  CH_index 
)

void mrbch_phy_sync_failure ( unsigned char  Mod_id,
unsigned char  Free_ch_index 
)

int mac_top_init ( void   ) 

char layer2_init_mr ( unsigned char  Mod_id  ) 

char layer2_init_ch ( unsigned char  Mod_id,
unsigned char  Free_ch_index 
)

void mac_switch_node_function ( unsigned char  Mod_id  ) 

int mac_init_global_param ( void   ) 

void mac_top_cleanup ( unsigned char  Mod_id  ) 

void mac_UE_out_of_sync_ind ( unsigned char  Mod_id,
unsigned short  CH_index 
)

void nodeb_mac_scheduler_tx ( unsigned char  Mod_id  ) 

void nodeb_mac_scheduler_rx ( unsigned char  Mod_id  ) 

void ue_mac_scheduler_tx ( unsigned char  Mod_id  ) 

void ue_mac_scheduler_rx ( unsigned char  Mod_id  ) 

void nodeb_generate_chbch ( unsigned char  Mod_id  ) 

This routine first retrieves the BCCH and CCCH logical channels from RRC. It then fills the UL and DL allocation maps as well as feedback channels in a CHBCH_PDU structure. Finally it generates a MACPHY_DATA_REQ for the PHY CHBCH transmitter.

Parameters:
Mod_id The MAC instance on which to act.

void ch_fill_dil_map ( unsigned char  Mod_id,
LCHAN_INFO_DIL_TABLE_ENTRY Lchan_entry 
)

This routine fills the CHBCH_PDU entries corresponding to a particular direct link logical channel.

Parameters:
Mod_id The MAC instance on which to act
*Lchan_entry Pointer to the logical channel physical channel allocations

void ch_fill_dl_map ( unsigned char  Mod_id,
LCHAN_INFO_TABLE_ENTRY Lchan_entry 
)

This routine fills the CHBCH_PDU entries corresponding to a particular downlink logical channel.

Parameters:
Mod_id The MAC instance on which to act
*Lchan_entry Pointer to the logical channel physical channel allocations

void ch_fill_ul_map ( unsigned char  Mod_id,
LCHAN_INFO_TABLE_ENTRY Lchan_entry 
)

This routine fills the CHBCH_PDU entries corresponding to a particular uplink logical channel. It operates in TTI $N-1$ and prepares a CHBCH_PDU which will be on-air in TTI $N$. Furthermore, the UL_MAP is used to schedule the RX resources (UL-SACH) for TTI $N+1$.

Parameters:
Mod_id The MAC instance on which to act
*Lchan_entry Pointer to the logical channel physical channel allocations

void nodeb_scheduler ( unsigned char  Mod_id  ) 

This routine is the top-level entry point for NodeB physical resource scheduling. It performs downlink, uplink and direct link scheduling for the next TTI based on measurement feedback (RF and traffic) from nodes and local measurements.

Parameters:
Mod_id The MAC instance on which to act

void nodeb_get_sach ( unsigned char  Mod_id  ) 

This routine generates a MACPHY_DATA_REQs in order to program NodeB PHY to receive a SACH and corresponding SCH. This is invoked in TTI $N-1$ for action in TTI $N$. The result is seen by NodeB MAC in TTI $N+1$.

Parameters:
Mod_id The MAC instance on which to act

void nodeb_decode_sch ( unsigned char  Mod_id,
UL_MEAS UL_meas,
unsigned short  Index 
)

This routine extracts the PHY measurements received from an SCH channel.

Parameters:
Mod_id The MAC instance on which to act
UL_meas Pointer to an UL_MEAS structure containing PHY RF UL measurements
Index SCH index

void nodeb_process_sacch ( unsigned char  Mod_id,
LCHAN_INFO_TABLE_ENTRY Lchan_entry,
unsigned char  Lchan_index,
unsigned char  User_index,
UL_SACCH_PDU Sacch_pdu 
)

void nodeb_decode_sach ( unsigned char  Mod_id,
UL_SACH_PDU Sach_pdu,
UL_MEAS UL_meas,
unsigned short  Lchan_id_index,
int *  crc_status 
)

This routine extracts the UL_SACCH information. It does nothing for the moment.

Parameters:
Mod_id The MAC instance on which to act
*Sach_pdu Pointer to an UL_SACH_PDU structure containing PHY transport blocks
*UL_meas Pointer to an UL_MEAS* structure(to be removed?)
Lchan_id_index Logical channel id
*crc_status Vector containing crc status of each transport block

void nodeb_get_rach ( unsigned char  Mod_id,
unsigned char  nb_rach 
)

This routine generates a MACPHY_DATA_REQ in order to program NodeB PHY to receive a set of RACH. This is invoked in TTI $N-1$ for action in TTI $N$. The result is seen by NodeB MAC in TTI $N+1$.

Parameters:
Mod_id The MAC instance on which to act
nb_rach Number of rach (for the moment always 1!)

void nodeb_decode_rach ( unsigned char  Mod_id,
RACH_PDU Rach_pdu 
)

This routine extracts the UL_SACCH information. It does nothing for the moment.

Parameters:
Mod_id The MAC instance on which to act
*Rach_pdu Pointer to an RACH_PDU structure containing PHY transport blocks

void nodeb_generate_sach ( unsigned char  Mod_id  ) 

This routine first retrieves the maps as well as feedback channels in a CHBCH_PDU structure. Finally it generates a MACPHY_DATA_REQ for the PHY DL_SACH transmitter.

Parameters:
Mod_id The MAC instance on which to act.

void schedule_dcch ( unsigned char  Mod_id,
unsigned char  User,
unsigned short *  Freq_alloc_map,
unsigned char *  User_alloc_map,
unsigned short  rb_map 
)

This routine is used by the NodeB scheduler to allocate resources for dcch channels.

Parameters:
Mod_id The MAC instance on which to act
User User index
Freq_alloc_map Current Frequency Allocation
*User_alloc_map Allocation of users to frequency groups (rbs)
*rb_map Frequency map pattern. Bitmap depending on number of rb to be allocated. Actual bitmaps are shifted based on CQI information

void ue_process_DL_meas ( unsigned char  Mod_id,
unsigned short  CH_index 
)

void ue_get_chbch ( unsigned char  Mod_id,
unsigned char  CH_index 
)

This routine generates a MACPHY_DATA_REQ in order to program UE PHY to receive a CHBCH. This is invoked in TTI $N-1$ for action in TTI $N$. The result is seen by UE MAC in TTI $N+1$.

Parameters:
Mod_id The MAC instance on which to act
CH_index The CH index

void ue_decode_chbch ( unsigned char  Mod_id,
CHBCH_PDU Chbch_pdu,
DL_MEAS DL_meas,
unsigned short  Index,
int  crc_status 
)

void ue_complete_dl_data_req ( unsigned char  Mod_id  ) 

void ue_get_dil_sach ( u8  Mod_id  ) 

void mac_check_rlc_queues_status ( unsigned  char,
unsigned  char,
UL_SACCH_FB  
)

void ue_fill_macphy_data_req ( unsigned  char,
LCHAN_INFO_TABLE_ENTRY ,
unsigned  char 
)

void ue_decode_sch ( unsigned char  Mod_id,
UL_MEAS UL_meas,
unsigned short  Index 
)

void ue_decode_sach ( unsigned  char,
DL_SACH_PDU ,
UL_MEAS UL_meas,
unsigned  short,
int *  crc_status 
)

void ue_generate_rach ( unsigned  char,
unsigned  char 
)

void ue_generate_sach ( unsigned  char  ) 

void ue_scheduler ( unsigned  char,
unsigned  char 
)

int clear_lchan_table ( LCHAN_INFO_TABLE_ENTRY Table,
unsigned char  Dim 
)

unsigned short mac_config_req ( unsigned char  Mod_id,
unsigned char  Action,
MAC_CONFIG_REQ Req 
)

unsigned short ch_mac_config_req ( unsigned char  Mod_id,
unsigned char  Action,
MAC_CONFIG_REQ Req 
)

unsigned short ue_mac_config_req ( unsigned char  Mod_id,
unsigned char  Action,
MAC_CONFIG_REQ Req 
)

MAC_MEAS_REQ_ENTRY* mac_meas_req ( unsigned char  Mod_id,
MAC_MEAS_REQ Meas_req 
)

MAC_MEAS_REQ_ENTRY* ch_mac_meas_req ( unsigned char  Mod_id,
MAC_MEAS_REQ Meas_req 
)

MAC_MEAS_REQ_ENTRY* ue_mac_meas_req ( unsigned char  Mod_id,
MAC_MEAS_REQ Meas_req 
)

void mac_update_meas ( unsigned char  Mod_id,
MAC_MEAS_REQ_ENTRY Meas_entry,
UL_MEAS UL_meas 
)

unsigned char mac_check_meas_trigger ( MAC_MEAS_REQ Meas_req  ) 

unsigned char mac_check_meas_ind ( MAC_MEAS_REQ_ENTRY Meas_entry  ) 

int add_openair2_stats ( void   ) 

This routine initialized the openair2 /proc/openair2 entry.

Returns:
0 on success

char * print_cqi ( unsigned int  cqi  ) 

This routine prints the CQI information.

Parameters:
cqi 32-bit CQI value
Returns:
A pointer to a string containing the CQI information

void copy_phy_resources ( PHY_RESOURCES To,
PHY_RESOURCES From 
)

void macphy_scheduler ( unsigned char  last_slot  ) 

void swap ( char *  Array,
char  a,
char  b 
)

char partition ( char *  a,
char *  ,
char  low,
char  high 
)

void quicksort ( char *  a,
char *  b,
char  low,
char  high 
)

void q_sort ( char  low,
char  high 
)


Generated on Thu May 14 10:34:29 2009 for OPENAIR by  doxygen 1.4.7