Changeset 550 for trunk/kernel/kern


Ignore:
Timestamp:
Sep 21, 2018, 10:24:15 PM (6 years ago)
Author:
nicolas.van.phan@…
Message:

Add SD card driver in kernel

File:
1 edited

Legend:

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

    r539 r550  
    423423        }
    424424
     425        ///////////////////////////////
    425426        else if ( func == DEV_FUNC_TXT && info->use_mty0 == 1 )
    426427        {
     
    465466                        }
    466467                    }
     468#if( DEBUG_KERNEL_INIT & 0x1 )
     469if( hal_time_stamp() > DEBUG_KERNEL_INIT )
     470printk("\n[DBG] %s : created MTY[%d] in cluster %x / chdev = %x\n",
     471__FUNCTION__ , channel , local_cxy , chdev_ptr );
     472#endif
    467473                }
    468474            }
    469475        }
     476
     477        ///////////////////////////////
     478        else if ( func == DEV_FUNC_IOC )
     479        {
     480            assert(impl == IMPL_IOC_SPI, __FUNCTION__,
     481                "Internal IOC should have SPI implementation\n");
     482
     483            for ( channel = 0; channel < channels; channel++ )
     484            {
     485                // create chdev in local cluster
     486                chdev_ptr = chdev_create( func,
     487                                          impl,
     488                                          channel,
     489                                          0,
     490                                          base );
     491
     492                assert( (chdev_ptr != NULL) , __FUNCTION__ ,
     493                    "cannot allocate memory for IOC chdev" );
     494               
     495                // make IOC specific initialization
     496                dev_ioc_init( chdev_ptr );
     497
     498                // set the IOC fields in all clusters
     499                xptr_t *chdev_entry = &chdev_dir.ioc[channel];
     500                for ( x = 0; x < info->x_max; x++ )
     501                {
     502                    for ( y = 0; y < info->y_max; y++ )
     503                    {
     504                        cxy_t cxy = (x<<info->y_width) + y;
     505                        hal_remote_swd( XPTR( cxy, chdev_entry ),
     506                                        XPTR( local_cxy, chdev_ptr ) );
     507                    }
     508    }
     509#if( DEBUG_KERNEL_INIT & 0x1 )
     510if( hal_time_stamp() > DEBUG_KERNEL_INIT )
     511printk("\n[DBG] %s : created IOC[%d] in cluster %x / chdev = %x\n",
     512__FUNCTION__ , channel , local_cxy , chdev_ptr );
     513#endif
     514            }
     515        }
     516
    470517    }
    471518}  // end internal_devices_init()
     
    556603                }
    557604
     605                if ( func == DEV_FUNC_IOC && impl == IMPL_IOC_SPI )
     606                {
     607                    continue;
     608                }
     609
    558610                // compute target cluster for chdev[func,channel,direction]
    559611                uint32_t offset     = ext_chdev_gid % ( info->x_size * (info->y_max) ); // [FIXME]
     
    814866                else if( func == DEV_FUNC_DMA ) lapic_input.dma[channel] = id;
    815867                else if( func == DEV_FUNC_TXT ) lapic_input.mtty = id;
     868                else if( func == DEV_FUNC_IOC ) lapic_input.sdcard = id;
    816869                else assert( false , "illegal source device for LAPIC input" );
    817870            }
Note: See TracChangeset for help on using the changeset viewer.