//--------------------------------------------------------------------------- // 印刷の実行 int __fastcall TPrintDlgBox::Execute(void) { if( (!mColCount) || (!mRowCount) ) return FALSE; int r = FALSE; if( PrintDialog->Execute() == TRUE ){ TForm *pActive = Screen->ActiveForm; if( pActive != NULL ) pActive->Enabled = FALSE; mAbort = 0; CWaitCursor tw; Printer()->Title = "MMANA"; Printer()->BeginDoc(); Printer()->Canvas->Font->Name = "MS ゴシック"; mRC = Printer()->Canvas->ClipRect; if( InitSetup(Printer()->Canvas) == FALSE ){ mAbort = 1; } tw.Delete(); if( !mAbort ){ Show(); for( mPage = 0; mPage < mPageMax; mPage++ ){ // 印刷ループ if( mPage ) Printer()->NewPage(); DispPageStat(); Application->ProcessMessages(); if( mAbort ) break; DrawRect(); Application->ProcessMessages(); if( mAbort ) break; DrawPage(); Application->ProcessMessages(); if( mAbort ) break; } } tw.Wait(); if( mAbort ){ Printer()->Abort(); } else { Printer()->EndDoc(); r = TRUE; } if( pActive != NULL ) pActive->Enabled = TRUE; Visible = FALSE; } return r; }
int main(int argc, char* argv[]) { //////////////////////////////////////////////////////////////////////////// struct GRTypes data_t; // data type structure data_t.VTXID_TYPE = VTXID_INT; // vertex identifier data_t.SIZET_TYPE = SIZET_INT; // graph size type data_t.VALUE_TYPE = VALUE_FLOAT; // attributes type struct GRSetup config = InitSetup(); // gunrock configurations int num_nodes = 7, num_edges = 26; int row_offsets[8] = {0, 3, 6, 11, 15, 19, 23, 26}; int col_indices[26] = {1, 2, 3, 0, 2, 4, 0, 1, 3, 4, 5, 0, 2, 5, 6, 1, 2, 5, 6, 2, 3, 4, 6, 3, 4, 5}; struct GRGraph *grapho = (struct GRGraph*)malloc(sizeof(struct GRGraph)); struct GRGraph *graphi = (struct GRGraph*)malloc(sizeof(struct GRGraph)); graphi->num_nodes = num_nodes; graphi->num_edges = num_edges; graphi->row_offsets = (void*)&row_offsets[0]; graphi->col_indices = (void*)&col_indices[0]; gunrock_pagerank(grapho, graphi, config, data_t); //////////////////////////////////////////////////////////////////////////// int *top_nodes = ( int*)malloc(sizeof( int) * graphi->num_nodes); float *top_ranks = (float*)malloc(sizeof(float) * graphi->num_nodes); top_nodes = ( int*)grapho->node_value2; top_ranks = (float*)grapho->node_value1; int node; for (node = 0; node < config.top_nodes; ++node) printf("Node_ID [%d] : Score: [%f]\n", top_nodes[node], top_ranks[node]); if (graphi) free(graphi); if (grapho) free(grapho); if (top_nodes) free(top_nodes); if (top_ranks) free(top_ranks); return 0; }
CmtSdCard* CmtSdCard::CreateCard( OMAP_MMCHS_REGS *mmc, CmtSdIsConnect isConnect ) { #endif uint8 MMCCmd[16]; if( isConnect() != CMTE_OK ) return 0; //Карта не подключена bool ret_val; bool sdCardType; uint32 factor; uint32 RCA = 1; uint32 argument; uint32 resp[4]; unsigned int trans_fact, trans_unit, retries = 2; unsigned int max_dtr; int dsor; volatile mmc_csd_reg_t Card_CSD; unsigned char trans_speed; cmtDebug1( 10, 1, "CreateCard init setup", 0 ); InitSetup( mmc ); do { cmtDebug1( 10, 2, "CreateCard detect card", 0 ); ret_val = DetectCard( mmc, &sdCardType, &factor, &RCA ); retries--; } while( (retries > 0) && !ret_val ); cmtDebug1( 10, 3, "CreateCard CMD9 RCA=%1", RCA ); argument = RCA << 16; if( !SendCommand( mmc, MMC_CMD9, argument, resp ) ) { cmtDebug1( 10, 3, "CreateCard CMD9 fail", 0 ); return 0; } memcpy( MMCCmd, resp, 16 ); ((unsigned int *)&Card_CSD)[3] = resp[3]; ((unsigned int *)&Card_CSD)[2] = resp[2]; ((unsigned int *)&Card_CSD)[1] = resp[1]; ((unsigned int *)&Card_CSD)[0] = resp[0]; // if (mmc_card_cur->card_type == MMC_CARD) // mmc_card_cur->version = Card_CSD.spec_vers; trans_speed = Card_CSD.tran_speed; cmtDebug1( 10, 5, "CreateCard trans_speed %1", trans_speed ); cmtDebug1( 10, 5, "CreateCard CMD4", 0 ); if( !SendCommand( mmc, MMC_CMD4, MMC_DSR_DEFAULT << 16, resp ) ) { cmtDebug1( 10, 6, "CreateCard CMD4 fail", 0 ); return 0; } #if 1 trans_unit = trans_speed & MMC_CSD_TRAN_SPEED_UNIT_MASK; trans_fact = trans_speed & MMC_CSD_TRAN_SPEED_FACTOR_MASK; if( trans_unit > MMC_CSD_TRAN_SPEED_UNIT_100MHZ ) return 0; if( (trans_fact < MMC_CSD_TRAN_SPEED_FACTOR_1_0) || (trans_fact > MMC_CSD_TRAN_SPEED_FACTOR_8_0) ) return 0; trans_unit >>= 0; trans_fact >>= 3; max_dtr = tran_exp[trans_unit] * tran_mant[trans_fact]; dsor = 96000000 / max_dtr; if( dsor == 4 ) dsor = 5; if( dsor == 3 ) dsor = 4; cmtDebug1( 10, 10, "CreateCard config dsor = %1", dsor ); ClockConfig( mmc, CLK_MISC, 7 ); //dsor ); #endif cmtDebug1( 10, 11, "CreateCard CMD7", 0 ); argument = RCA << 16; if( !SendCommand( mmc, MMC_CMD7_SELECT, argument, resp ) ) { cmtDebug1( 10, 12, "CreateCard CMD7 fail", 0 ); return 0; } /* Configure the block length to 512 bytes */ cmtDebug1( 10, 14, "CreateCard CMD16", 0 ); if( !SendCommand( mmc, MMC_CMD16, 512, resp ) ) { cmtDebug1( 10, 15, "CreateCard CMD16 fail", 0 ); return 0; } //Анализ размера карты (определение количества блоков) uint32 blockCount; //Количество блоков по 512 байт if( factor == 0 ) { //mmc_dev_data->mode == SECTOR_MODE if( sdCardType ) { //mmc_dev_data->card_type == SD_CARD blockCount = (((mmc_sd2_csd_reg_t *) &Card_CSD)->c_size_lsb & MMC_SD2_CSD_C_SIZE_LSB_MASK) | ((((mmc_sd2_csd_reg_t *) &Card_CSD)->c_size_msb & MMC_SD2_CSD_C_SIZE_MSB_MASK) << MMC_SD2_CSD_C_SIZE_MSB_OFFSET); blockCount *= 1024; } else { mmc_extended_csd_reg_t ext_csd; argument = 0x00000000; cmtDebug1( 10, 16, "CreateCard CMD8", 0 ); if( !SendCommand( mmc, MMC_CMD8, argument, resp ) ) { cmtDebug1( 10, 15, "CreateCard CMD8 fail", 0 ); return 0; } if( !GetData( mmc, (uint32*)(&ext_csd) ) ) { cmtDebug1( 10, 16, "CreateCard CMD8 GetData fail", 0 ); return 0; } blockCount = ext_csd.sectorcount; if( blockCount == 0 ) blockCount = 8388608; } } else { if( Card_CSD.c_size_mult >= 8 ) return 0; if( Card_CSD.read_bl_len >= 12 ) return 0; /* Compute size */ uint32 count = 1 << (Card_CSD.c_size_mult + 2); uint32 card_size = (Card_CSD.c_size_lsb & MMC_CSD_C_SIZE_LSB_MASK) | ((Card_CSD.c_size_msb & MMC_CSD_C_SIZE_MSB_MASK) << MMC_CSD_C_SIZE_MSB_OFFSET); uint32 blk_no = (card_size + 1) * count; uint32 blk_len = 1 << Card_CSD.read_bl_len; uint32 size = blk_no * blk_len; blockCount = size >> 9; } cmtDebug1( 10, 21, "card blocks %1", blockCount ); cmtDebug1( 10, 22, "card factor %1", factor ); //Построить объект карты #ifdef CMT_DMA return new CmtSdCard( mmc, isConnect, factor, 512, blockCount, dmaRx, dmaTx ); #else return new CmtSdCard( mmc, isConnect, factor, 512, blockCount ); #endif }