s3c6410 ARM11开发板BSP构建

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

嵌入式培训专家S3C6410ARM11S3C6410ARM11开发板开发板LinuxBSPLinuxBSP构建构建主讲:宋宝华华清远见今天的内容vBSP的组成部分vplat/mach各组件的实现Ø内核节拍Ø中断管理Ø时钟ØGPIOØDMAØIO内存映射v设备与资源Øplatformdevice、resource和plarformdataØuart/spi/i2c等设备板级resource华清远见BSP的组成部分vBSP作用Ø为内核的运行提供底层支撑Ø屏蔽与板相关的硬件细节v基本组成Ø时钟tick(HZ)的产生Ø系统中断控制的方法ØGPIO、DMA、时钟资源的统一管理Ø静态映射的IO内存Ø设备的IO、中断、DMA等资源封装平台数据华清远见ARMBSP的目录vplat-xxxlinux-2.6/arch/arm/plat-omap/plat-pxa/plat-s3c/plat-s3c24xx/plat-s3c64xx/plat-stmp3xxx/vmach-xxxlinux-2.6/arch/arm/mach-s3c2400/mach-s3c2410/mach-s3c2412/mach-s3c2440/mach-s3c2442/mach-s3c2443/mach-s3c24a0/mach-s3c6400/mach-s3c6410/华清远见时钟节拍的产生vsys_timer和timer_tickstaticirqreturn_ts3c2410_timer_interrupt(intirq,void*dev_id){timer_tick();returnIRQ_HANDLED;}staticstructirqactions3c2410_timer_irq={.name=S3C2410TimerTick,.flags=IRQF_DISABLED|IRQF_TIMER|IRQF_IRQPOLL,.handler=s3c2410_timer_interrupt,};staticvoid__inits3c2410_timer_init(void){s3c2410_timer_resources();s3c2410_timer_setup();setup_irq(IRQ_TIMER4,&s3c2410_timer_irq);}structsys_timers3c24xx_timer={.init=s3c2410_timer_init,.offset=s3c2410_gettimeoffset,.resume=s3c2410_timer_setup};华清远见系统中断管理virq_chipstaticstructirq_chips3c_irq_uart={.name=s3c-uart,.mask=s3c_irq_uart_mask,.unmask=s3c_irq_uart_unmask,.mask_ack=s3c_irq_uart_maskack,.ack=s3c_irq_uart_ack,};staticvoid__inits3c64xx_uart_irq(structuart_irq*uirq){for(offs=0;offs3;offs++){irq=uirq-base_irq+offs;set_irq_chip(irq,&s3c_irq_uart);set_irq_chip_data(irq,uirq);set_irq_handler(irq,handle_level_irq);set_irq_flags(irq,IRQF_VALID);}set_irq_chained_handler(uirq-parent_irq,s3c_irq_demux_uart);}void__inits3c64xx_init_irq(u32vic0_valid,u32vic1_valid){set_irq_chip(irq,&s3c_irq_timer);...for(uart=0;uartARRAY_SIZE(uart_irqs);uart++)s3c64xx_uart_irq(&uart_irqs[uart]);}华清远见GPIO管理vgpio_chip和统一的gpio_xxxAPIstructgpio_chip{int(*request)(structgpio_chip*chip,unsignedoffset);void(*free)(structgpio_chip*chip,unsignedoffset);int(*direction_input)(structgpio_chip*chip,unsignedoffset);int(*get)(structgpio_chip*chip,unsignedoffset);int(*direction_output)(structgpio_chip*chip,unsignedoffset,intvalue);void(*set)(structgpio_chip*chip,unsignedoffset,intvalue);};intgpio_request(unsignedgpio,constchar*label);voidgpio_free(unsignedgpio);intgpio_direction_input(unsignedgpio);intgpio_direction_output(unsignedgpio,intvalue);intgpio_get_value_cansleep(unsignedgpio);华清远见CLOCK管理v提供统一的clk_get、clk_put等API:ØEXPORT_SYMBOL(clk_get);ØEXPORT_SYMBOL(clk_put);ØEXPORT_SYMBOL(clk_enable);ØEXPORT_SYMBOL(clk_disable);ØEXPORT_SYMBOL(clk_get_rate);ØEXPORT_SYMBOL(clk_round_rate);ØEXPORT_SYMBOL(clk_set_rate);ØEXPORT_SYMBOL(clk_get_parent);ØEXPORT_SYMBOL(clk_set_parent);华清远见DMA管理v统一的DMAAPI支持:Øintrequest_dma(unsignedintchan,constchar*device_id);Øvoidfree_dma(unsignedintchan);Øvoidenable_dma(unsignedintchan);Øvoiddisable_dma(unsignedintchan);Øvoidset_dma_mode(unsignedintchan,unsignedintmode);Øvoidset_dma_sg(unsignedintchan,structscatterlist*sg,intnr_sg);华清远见IO内存静态映射vmap_desc和iotable_initstaticstructmap_descs3c_iodesc[]__initdata={{.virtual=(unsignedlong)S3C_VA_SYS,.pfn=__phys_to_pfn(S3C64XX_PA_SYSCON),.length=SZ_4K,.type=MT_DEVICE,},{...},};void__inits3c64xx_init_io(structmap_desc*mach_desc,intsize){…iotable_init(s3c_iodesc,ARRAY_SIZE(s3c_iodesc));iotable_init(mach_desc,size);}华清远见platform_device和资源vplatform_device和resourcestaticstructresourcesmdk6410_smsc911x_resources[]={[0]={.start=0x18000000,.end=0x18000000+SZ_64K-1,.flags=IORESOURCE_MEM,},[1]={.start=S3C_EINT(10),.end=S3C_EINT(10),.flags=IORESOURCE_IRQ|IRQ_TYPE_LEVEL_LOW,},};staticstructplatform_devicesmdk6410_smsc911x={.name=smsc911x,.id=-1,.num_resources=ARRAY_SIZE(smdk6410_smsc911x_resources),.resource=&smdk6410_smsc911x_resources[0],};华清远见platform数据v提供与板相关的硬件设置数据staticstructsmsc911x_platform_configsmdk6410_smsc911x_pdata={.irq_polarity=SMSC911X_IRQ_POLARITY_ACTIVE_LOW,.irq_type=SMSC911X_IRQ_TYPE_OPEN_DRAIN,.flags=SMSC911X_USE_32BIT|SMSC911X_FORCE_INTERNAL_PHY,.phy_interface=PHY_INTERFACE_MODE_MII,};staticstructplatform_devicesmdk6410_smsc911x={....dev={.platform_data=&smdk6410_smsc911x_pdata,},};structsmsc911x_platform_config由对应设备的驱动定义,而platform_data则由驱动引用。华清远见SPI板级信息vspi_board_infostaticstructspi_board_info__initdatajive_spi_devs[]={[0]={.modalias=VGG2432A4,.bus_num=1,.chip_select=0,.mode=SPI_MODE_3,/*CPOL=1,CPHA=1*/.max_speed_hz=100000,.platform_data=&jive_lcm_config,},{.modalias=WM8750,.bus_num=2,.chip_select=0,.mode=SPI_MODE_0,/*CPOL=0,CPHA=0*/.max_speed_hz=100000,},};spi_register_board_info(jive_spi_devs,ARRAY_SIZE(jive_spi_devs));华清远见I2C板级信息vi2c_board_infostaticstructi2c_board_infoi2c_devs0[]__initdata={{I2C_BOARD_INFO(24c08,0x50),},{I2C_BOARD_INFO(wm8580,0x1b),},#ifdefCONFIG_SMDK6410_WM1190_EV1{I2C_BOARD_INFO(wm8350,0x1a),.platform_data=&smdk6410_wm8350_pdata,.irq=S3C_EINT(12),},#endif};staticvoid__initsmdk6410_machine_init(void){...i2c_register_board_info(0,i2c_devs0,ARRAY_SIZE(i2c_devs0));i2c_register_board_info(1,i2c_devs1,ARRAY_SIZE(i2c_devs1));...}华清远见MACHINE_STARTMACHINE_START(SMDK6410,SMDK6410)/*Maintainer:BenDooksben@fluff.org

1 / 22
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功