/** * @brief: initial ak3916 machine * * @author: caolianming * @date: 2014-01-09 */ static void __init ak3910_init_machine(void) { adc1_init(); spi_register_board_info(ak39_spi_board_dev, ARRAY_SIZE(ak39_spi_board_dev)); ak39_spi1_device.dev.platform_data = &ak39_spi1_info; ak39_motor0_device.dev.platform_data = &ak39_motor0_pdata; ak39_motor1_device.dev.platform_data = &ak39_motor1_pdata; ak39_mmc_device.dev.platform_data = &mmc_plat_data; ak39_sdio_device.dev.platform_data = &sdio_plat_data; ak39_crypto_device.dev.platform_data = &akcrypto_pdata; ak39_usb_otg_hcd_device.dev.platform_data = &akotghc_plat_data; ak39_mac_device.dev.platform_data = &ak39_mac_pdata; ak39_led_pdev.dev.platform_data = &led_pdata; ak39_gpio_keys_device.dev.platform_data = &gpio_keys_platform_data; ak39_battery_power.dev.platform_data = &ak39_bat_info; ak39_camera_interface.dev.platform_data = &ak39_camera_info; platform_add_devices(ak3910_platform_devices, ARRAY_SIZE(ak3910_platform_devices)); l2_init(); return; }
static int net_init(struct device *unused) { int status = 0; NET_DBG("Priority %d", CONFIG_NET_INIT_PRIO); net_shell_init(); net_pkt_init(); net_context_init(); l2_init(); l3_init(); net_mgmt_event_init(); init_rx_queue(); #if CONFIG_NET_DHCPV4 status = dhcpv4_init(); if (status) { return status; } #endif return status; }
/* answer to the pcscd polling */ int readPresence() { if (present == 1) { return present; } if (l2_init(layer2) < 0) { return 0; } if (l3_init(protocol) < 0) { return 0; } present = 1; return 1; }
int main (int argc, char **argv) { args_t args; LTE_DL_FRAME_PARMS frame_parms0; LTE_DL_FRAME_PARMS *frame_parms=&frame_parms; char sdu0[16],sdu1[64],sdu2[1024],sdu3[1024],sdu4[1024]; unsigned short sdu_len0,sdu_len1,sdu_len2,sdu_len3,sdu_len4; char ulsch_buffer[1024],dlsch_buffer[1024]; u8 lcid; u8 payload_offset; int i,comp; logInit(); NB_UE_INST = 1; NB_eNB_INST = 1; NB_INST=2; // Parse arguments if(parse_args(argc, argv, &args) > 0) { print_usage(argv[0]); exit(1); } set_taus_seed(0); logInit(); set_glog(LOG_TRACE, 1); for (comp = PHY; comp < MAX_LOG_COMPONENTS ; comp++) set_comp_log(comp, LOG_TRACE, LOG_NONE, 1); /* set_log(OMG, LOG_INFO, 20); set_log(EMU, LOG_INFO, 10); set_log(OCG, LOG_INFO, 1); set_log(MAC, LOG_TRACE, 1); set_log(RLC, LOG_TRACE, 1); set_log(PHY, LOG_DEBUG, 1); set_log(PDCP, LOG_TRACE, 1); set_log(RRC, LOG_TRACE, 1); */ mac_xface = (MAC_xface *)malloc(sizeof(MAC_xface)); init_lte_vars (&frame_parms, 0, 1, 0, 0, 25, 0, 0, 1, 1); l2_init(frame_parms); // Generate eNB SI if (args.input_sib == 0) { openair_rrc_lite_eNB_init(0); } else { printf("Got SI from files (%d,%d,%d,%d,%d)\n",args.input_sib,args.input1_sdu_flag,args.input2_sdu_flag); } openair_rrc_on(0,0); openair_rrc_lite_ue_init(0,0); switch (args.SDUsource) { case eNB_RRC: if (args.RRCmessage == RRCSIB1) { if (args.input1_sdu_flag == 1) { for (i=0; i<args.input1_sdu_len; i++) printf("%02x",args.input1_sdu[i]); printf("\n"); ue_decode_si(0,142,0,args.input1_sdu,args.input1_sdu_len); } else { printf("\n\nSIB1\n\n"); for (i=0; i<eNB_rrc_inst[0].sizeof_SIB1; i++) printf("%02x",eNB_rrc_inst[0].SIB1[i]); printf("\n"); } } else if (args.RRCmessage == RRCSIB2_3) { if (args.input1_sdu_flag == 1) { for (i=0; i<args.input2_sdu_len; i++) printf("%02x",args.input2_sdu[i]); printf("\n"); ue_decode_si(0,149,0,args.input1_sdu,args.input1_sdu_len); } else { printf("\n\nSIB2_3\n\n"); for (i=0; i<eNB_rrc_inst[0].sizeof_SIB23; i++) printf("%02x",eNB_rrc_inst[0].SIB23[i]); printf("\n"); } } else if ((args.input1_sdu_flag == 1)&& ((args.RRCmessage == RRCConnectionSetup) || (args.RRCmessage == RRCConnectionReconfiguration))) { sdu_len0 = attach_ue0(sdu0); ue_send_sdu(0,143,args.input1_sdu,args.input1_sdu_len,0); if (args.RRCmessage == RRCConnectionReconfiguration) ue_send_sdu(0,144,args.input2_sdu,args.input2_sdu_len,0); } else { switch (args.RRCmessage) { case RRCConnectionSetup: printf("Doing eNB RRCConnectionSetup\n"); sdu_len0 = attach_ue0(sdu0); sdu_len1 = attach_ue1(sdu1); lcid = 0; payload_offset = generate_dlsch_header(dlsch_buffer, 1, //num_sdus &sdu_len1, // &lcid, // sdu_lcid 255, // no drx 0, // no timing advance sdu0, // contention res id 0,0); memcpy(&dlsch_buffer[payload_offset],sdu1,sdu_len1); printf("\nRRCConnectionSetup (DLSCH input / MAC output)\n\n"); for (i=0; i<sdu_len1+payload_offset; i++) printf("%02x ",(unsigned char)sdu1[i]); printf("\n"); break; case RRCConnectionReconfiguration: printf("Doing eNB RRCConnectionReconfiguration\n"); sdu_len0 = attach_ue0(sdu0); sdu_len1 = attach_ue1(sdu1); sdu_len2 = attach_ue2(sdu1,sdu_len1,sdu2); sdu_len3 = attach_ue3(sdu2,sdu_len2,sdu3); lcid=1; payload_offset = generate_dlsch_header(dlsch_buffer, // offset = generate_dlsch_header((unsigned char*)eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0], 1, //num_sdus &sdu_len3, // &lcid, 255, // no drx 1, // timing advance NULL, // contention res idk 0,0); memcpy(&dlsch_buffer[payload_offset],sdu3,sdu_len3); printf("\nRRCConnectionReconfiguration (DLSCH input / MAC output)\n\n"); for (i=0; i<sdu_len3+payload_offset; i++) printf("%02x ",(unsigned char)dlsch_buffer[i]); printf("\n"); break; default: printf("Unknown eNB_RRC SDU (%d), exiting\n",args.RRCmessage); break; } break; } break; case eNB_MAC: sdu_len0 = attach_ue0(sdu0); ue_send_sdu(0,143,args.input1_sdu,args.input1_sdu_len,0); break; case UE_RRC: switch (args.RRCmessage) { case RRCConnectionRequest: sdu_len0 = attach_ue0(sdu0); printf("\n\nRRCConnectionRequest\n\n"); for (i=0; i<sdu_len0; i++) printf("%02x ",(unsigned char)sdu0[i]); printf("\n"); break; case RRCConnectionSetupComplete: sdu_len0=attach_ue0(sdu0); sdu_len1 = attach_ue1(sdu1); sdu_len2 = attach_ue2(sdu1,sdu_len1,sdu2); lcid=1; printf("Got sdu of length %d\n",sdu_len2); payload_offset = generate_ulsch_header((u8*)ulsch_buffer, // mac header 1, // num sdus 0, // short pading &sdu_len2, // sdu length &lcid, // sdu lcid NULL, // power headroom NULL, // crnti NULL, // truncated bsr NULL, // short bsr NULL, // long_bsr 0); printf("Got MAC header of length %d\n",payload_offset); memcpy(&ulsch_buffer[payload_offset],sdu2,sdu_len2); printf("\n\nRRCConnectionSetupComplete (ULSCH input / MAC output)\n\n"); for (i=0; i<sdu_len2+payload_offset; i++) printf("%02x ",(unsigned char)ulsch_buffer[i]); printf("\n"); break; case RRCConnectionReconfigurationComplete: sdu_len0=attach_ue0(sdu0); sdu_len1=attach_ue1(sdu1); sdu_len2 = attach_ue2(sdu1,sdu_len1,sdu2); sdu_len3 = attach_ue3(sdu2,sdu_len2,sdu3); sdu_len4 = attach_ue4(sdu3,sdu_len3,sdu4); lcid=1; printf("Got sdu of length %d\n",sdu_len4); payload_offset = generate_ulsch_header((u8*)ulsch_buffer, // mac header 1, // num sdus 0, // short pading &sdu_len4, // sdu length &lcid, // sdu lcid NULL, // power headroom NULL, // crnti NULL, // truncated bsr NULL, // short bsr NULL, // long_bsr 0); printf("Got MAC header of length %d\n",payload_offset); memcpy(&ulsch_buffer[payload_offset],sdu4,sdu_len4); printf("\n\nRRCConnectionReconfigurationComplete (ULSCH input / MAC output)\n\n"); for (i=0; i<sdu_len4+payload_offset; i++) printf("%02x ",(unsigned char)ulsch_buffer[i]); printf("\n"); break; default: printf("Unknown UE_RRC SDU (%d), exiting\n",args.RRCmessage); break; } break; } free(mac_xface); return(0); }