Ignore:
Timestamp:
Aug 22, 2018, 11:55:48 PM (6 years ago)
Author:
viala@…
Message:

Refactoring assert calling to conform with new assert macro.

Made with this command for the general case.
find ./kernel/ hal/ -name "*.c" | xargs sed -i -e '/assert(/ s/,[ ]*FUNCTION[ ]*,/,/'

And some done by hand.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/kern/kernel_init.c

    r490 r492  
    231231        if (func == DEV_FUNC_TXT )
    232232        {
    233             assert( (channels > 0) , __FUNCTION__ , "number of TXT channels cannot be 0\n");
     233            assert( (channels > 0) , "number of TXT channels cannot be 0\n");
    234234
    235235            // initializes TXT_TX[0] chdev
     
    298298        if( func == DEV_FUNC_MMC ) 
    299299        {
    300             assert( (channels == 1) , __FUNCTION__ ,
    301                     "MMC device must be single channel\n" );
     300            assert( (channels == 1) , "MMC device must be single channel\n" );
    302301
    303302            // create chdev in local cluster
     
    308307                                      base );
    309308
    310             assert( (chdev_ptr != NULL) , __FUNCTION__ ,
     309            assert( (chdev_ptr != NULL) ,
    311310                    "cannot allocate memory for MMC chdev\n" );
    312311           
     
    344343                                          base );
    345344
    346                 assert( (chdev_ptr != NULL) , __FUNCTION__ ,
    347                         "cannot allocate memory for DMA chdev" );
     345                assert( (chdev_ptr != NULL) , "cannot allocate memory for DMA chdev" );
    348346           
    349347                // make DMA specific initialisation
     
    420418
    421419        // check PIC device initialized
    422         assert( (chdev_dir.pic != XPTR_NULL ) , __FUNCTION__ ,
     420        assert( (chdev_dir.pic != XPTR_NULL ) ,
    423421              "PIC device must be initialized before other devices\n" );
    424422
     
    428426                  (func == DEV_FUNC_TXT) ||
    429427                  (func == DEV_FUNC_NIC) ||
    430                   (func == DEV_FUNC_FBF) ) , __FUNCTION__ ,
     428                  (func == DEV_FUNC_FBF) ) ,
    431429                  "undefined external peripheral type\n" );
    432430
     
    456454                                          base );
    457455
    458                     assert( (chdev != NULL), __FUNCTION__ ,
     456                    assert( (chdev != NULL),
    459457                            "cannot allocate external device" );
    460458
     
    544542    }
    545543
    546     assert( found , __FUNCTION__ , "PIC device not found\n" );
     544    assert( found , "PIC device not found\n" );
    547545
    548546    // allocate and initialize the PIC chdev in cluster 0
     
    553551                          base );
    554552
    555     assert( (chdev != NULL), __FUNCTION__ , "no memory for PIC chdev\n" );
     553    assert( (chdev != NULL), "no memory for PIC chdev\n" );
    556554
    557555    // make PIC device type specific initialisation
     
    607605            else if((func == DEV_FUNC_TXT) && (is_rx == 0)) ptr = &iopic_input.txt_tx[channel];
    608606            else if((func == DEV_FUNC_TXT) && (is_rx != 0)) ptr = &iopic_input.txt_rx[channel];
    609             else if((func == DEV_FUNC_NIC) && (is_rx == 0)) ptr = &iopic_input.nic_tx[channel]; 
    610             else if((func == DEV_FUNC_NIC) && (is_rx != 0)) ptr = &iopic_input.nic_rx[channel]; 
    611             else if( func == DEV_FUNC_IOB )                 ptr = &iopic_input.iob; 
    612             else     assert( false , __FUNCTION__ , "illegal source device for IOPIC input" );
     607            else if((func == DEV_FUNC_NIC) && (is_rx == 0)) ptr = &iopic_input.nic_tx[channel];
     608            else if((func == DEV_FUNC_NIC) && (is_rx != 0)) ptr = &iopic_input.nic_rx[channel];
     609            else if( func == DEV_FUNC_IOB )                 ptr = &iopic_input.iob;
     610            else     assert( false , "illegal source device for IOPIC input" );
    613611
    614612            // set one entry in all "iopic_input" structures
     
    697695                if     ( func == DEV_FUNC_MMC ) lapic_input.mmc = id;
    698696                else if( func == DEV_FUNC_DMA ) lapic_input.dma[channel] = id;
    699                 else assert( false , __FUNCTION__ , "illegal source device for LAPIC input" );
     697                else assert( false , "illegal source device for LAPIC input" );
    700698            }
    701699        }
     
    818816    if( error )
    819817    {
    820         assert( false , __FUNCTION__ ,
     818        assert( false ,
    821819        "illegal core identifiers gid = %x / cxy = %x / lid = %d",
    822820        core_lid , core_cxy , core_lid );
     
    830828        if( error )
    831829        {
    832             assert( false , __FUNCTION__ ,
     830            assert( false ,
    833831            "cannot initialise cluster %x", local_cxy );
    834832        }
     
    950948            fatfs_ctx_t * fatfs_ctx = fatfs_ctx_alloc();
    951949
    952             assert( (fatfs_ctx != NULL) , __FUNCTION__ ,
     950            assert( (fatfs_ctx != NULL) ,
    953951                    "cannot create FATFS context in cluster 0\n" );
    954952
     
    973971                                      &vfs_root_inode_xp );                // return
    974972
    975             assert( (error == 0) , __FUNCTION__ ,
     973            assert( (error == 0) ,
    976974                    "cannot create VFS root inode\n" );
    977975
     
    987985            vfs_ctx_t   * vfs_ctx = &fs_context[FS_TYPE_FATFS];
    988986            assert( (((fatfs_ctx_t *)vfs_ctx->extend)->sectors_per_cluster == 8),
    989             __FUNCTION__ , "illegal value for FATFS context in cluster %x\n", local_cxy );
     987            "illegal value for FATFS context in cluster %x\n", local_cxy );
    990988        }
    991989        else
    992990        {
    993             assert( false , __FUNCTION__ ,
     991            assert( false ,
    994992            "root FS must be FATFS" );
    995993        }
     
    10281026            fatfs_ctx_t * local_fatfs_ctx = fatfs_ctx_alloc();
    10291027
    1030             assert( (local_fatfs_ctx != NULL) , __FUNCTION__ ,
     1028            assert( (local_fatfs_ctx != NULL) ,
    10311029            "cannot create FATFS context in cluster %x\n", local_cxy );
    10321030
     
    10501048            // 7. check initialisation
    10511049            assert( (((fatfs_ctx_t *)vfs_ctx->extend)->sectors_per_cluster == 8),
    1052             __FUNCTION__ , "illegal value for FATFS context in cluster %x\n", local_cxy );
     1050            "illegal value for FATFS context in cluster %x\n", local_cxy );
    10531051        }
    10541052
     
    10891087        devfs_ctx_t * devfs_ctx = devfs_ctx_alloc();
    10901088
    1091         assert( (devfs_ctx != NULL) , __FUNCTION__ ,
     1089        assert( (devfs_ctx != NULL) ,
    10921090                "cannot create DEVFS context in cluster IO\n");
    10931091
Note: See TracChangeset for help on using the changeset viewer.