code highlight test

Like below code, it is part of Linux kernel source.

  1. Put it into Qt, to format it first.
  2. Copy the code from Qt and paste it here. And then follow the instruction from the link.   http://en.support.wordpress.com/code/posting-source-code/
  3. Add the ‘blank lines’ manually.
  4. gutter: 表示是否显示行号。
    collapse: 表示将贴出的代码收缩为一行,点击后才展开,适合贴大段代码。
    wraplines: 表示是否对贴出的代码启动自动换行,选择”false”,则不会自动换行,出现水平轴的滚动条。
/*
 * linux/arch/arm/mach-omap2/board-2430sdp-flash.c
 *
 * Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com>
 * Author: Kevin Hilman
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <asm/mach/flash.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/mtd/onenand_regs.h>

#include <asm/io.h>
#include <mach/onenand.h>
#include <mach/board.h>
#include <mach/gpmc.h>
#include <mach/nand.h>

#define ONENAND_MAP 0x20000000
#define GPMC_OFF_CONFIG1_0 0x60

enum fstype {
        NAND = 0,
        NOR,
        ONENAND,
        UNKNOWN = -1
};

static enum fstype flash_type = NAND;

static struct mtd_partition nand_partitions[] = {
        {
                .name		= "X-Loader",
                .offset		= 0,
                .size		= 4*(64*2048),  /* 0-3 blks reserved. Mandated by ROM code */
                .mask_flags	= MTD_WRITEABLE	/* force read-only */
        },
        {
                .name		= "U-Boot",
                .offset		= MTDPART_OFS_APPEND,
                .size		=  4*(64*2048),
                .mask_flags	= MTD_WRITEABLE	/* force read-only */
        },
        {
                .name		= "U-Boot Environment",
                .offset		= MTDPART_OFS_APPEND,
                .size		= 2*(64*2048),
        },
        {
                .name		= "Kernel",
                .offset		= MTDPART_OFS_APPEND,
                .size		= 32*(64*2048),		/* 4*1M */
        },
        {
                .name		= "File System",
                .offset		= MTDPART_OFS_APPEND,
                .size		= MTDPART_SIZ_FULL,
        },
};
Advertisements

Hello my blog!

This is my first post. Just to try it! From Windows Live Writer.

%d bloggers like this: