Dear Lukasz,

In message <20120727153345.008fde41@amdc308.digital.local> you wrote:
> 
> So I suppose, that you are proposing something like this (pseudo code):

Yes, very close.

> int mmc_block_write() {
>       sprintf(cmd_buf, "mmc write 0x%x %x %x")
>       run_command(cmd_buf, 0);
> }
> 
> int mmc_file_write(enum fs_type) {
>       switch (fs_type)
>       case FAT:
>               sprintf(cmd_buf, "fatwrite mmc %d:%d 0x%x %s %lx")
>       break;
>       case EXT4:
>               sprintf(cmd_buf, "ext4write mmc %d:%d 0x%x %s %lx")
>       break;
>       run_command(cmd_buf);
> }


> int dfu_write_medium_mmc(struct dfu_entity *dfu, void *buf, long *len)
> {

I suggest just use 

        int dfu_write_medium(struct dfu_entity *dfu, void *buf, long *len)

here; you can then so something like

        switch (dfu->dev_type) {
        case MMC:       block_write = mmc_block_write;
                        file_write  = mmc_file_write;
                        break;
#ifdef NAND_SUPPORT_AVAILABLE
        case NAND:      block_write = nand_block_write;
                        file_write  = nand_block_write;
                        break;
#endif
        ...

and use block_write() resp. file_write() in the rest.  So the code is
really trivial to extend for other storage devices and file systems.

I feel we are very close, thanks!

Let's see if Pavel adds some comments about the best API to chose to
be as compatible with possible with the upcoming block device layer,
and then we can go for it.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Houston, Tranquillity Base here.  The Eagle has landed.
                                                    -- Neil Armstrong
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to