- 博客(22)
- 资源 (11)
- 收藏
- 关注
原创 070 - Climbing Stairs
You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?int climbStairs(int n) {
2015-12-30 16:45:16 399
原创 069 - Sqrt(x)
Implement int sqrt(int x).Compute and return the square root of x.int mySqrt(int x){ int left = 1; int right = x >= 50000 ? 50000 : x; int mid; while (left <= right) { mid = (left + rig
2015-12-30 16:44:07 308
原创 068 - Text Justification
Given an array of words and a length L, format the text such that each line has exactlyL characters and is fully (left and right) justified.You should pack your words in a greedy approach; that is
2015-12-30 16:42:18 277
原创 067 - Add Binary
Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".char* addBinary(char* a, char* b) { int lena = strlen(a); int lenb = strlen(b
2015-12-30 16:41:19 283
原创 066 - Plus One
Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.int* plusOne(int* di
2015-12-30 16:40:46 274
原创 065 - Valid Number
Validate if a given string is numeric.Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueNote: It is intended for the problem statement to be ambiguous.
2015-12-30 16:38:21 286
原创 064 - Minimum Path Sum
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right whichminimizes the sum of all numbers along its path.Note: You can only move either down or right at
2015-12-30 16:37:08 269
原创 063 - Unique Paths II
Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and 0 respectively in the grid.
2015-12-30 16:35:42 277
原创 062 - Unique Paths
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the bo
2015-12-30 16:34:45 255
原创 061 - Rotate List
Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL./** * Definition for singly-link
2015-12-30 16:33:53 273
原创 C简短代码集合
自己写的,或者看到别人写的,有趣的简短代码集合检测大小端#include int main(int argc, char *argv[]){ return printf("%s Endian\n", *(short *)"\x12\x34" == 0x1234 ? "Big" : "Little");}一个单链表,不知道长度,写一个函数快速找到中间节点位
2015-12-30 16:18:13 430
原创 命令 与 bash shell脚本
有些脚本也是来自网络,这里就不一一注明了1: 编码转换脚本首先可以用file命令查看当前乱码文本的编码,再执行脚本转换#!/bin/bash if [ "$#" != "2" ]; then echo "Usage: `basename $0` dir filter" exitfidir=$1filter=$2echo $1for file in `fi
2015-12-30 16:06:03 284
原创 snull驱动环境搭建与测试分析
Here are possible values for the network numbers. Once you put these lines in /etc/networks, you can call your networks by name.The values were chosen from the range of numbers reserved for priv
2015-12-18 17:05:36 700
原创 DM9000网卡驱动源码分析系列08 - 整理补充
/* * Davicom DM9000 Fast Ethernet driver for Linux. * Copyright (C) 1997 Sten Wang * * This program is free software; you can redistribute it and/or * modify it under the terms of the GN
2015-12-10 09:29:46 894
原创 DM9000网卡驱动源码分析系列07 - interrupt && read && write
static void dm9000_schedule_poll(struct board_info *db){ if (db->type == TYPE_DM9000E) schedule_delayed_work(&db->phy_poll, HZ * 2);}区别对待dm9000e, 如果是dm9000e 则在这里schedule_delayed_work, HZ代表1秒如
2015-12-09 17:23:19 692
原创 DM9000网卡驱动源码分析系列06 - open && stop
static void dm9000_mask_interrupts(struct board_info *db){ iow(db, DM9000_IMR, IMR_PAR);}屏蔽中断static void dm9000_unmask_interrupts(struct board_info *db){ iow(db, DM9000_IMR, db->imr_all);}恢复
2015-12-09 16:19:47 750
原创 DM9000网卡驱动源码分析系列05 - net_device_ops(ioctl ...)
static const struct net_device_ops dm9000_netdev_ops = { .ndo_open = dm9000_open, .ndo_stop = dm9000_stop, .ndo_start_xmit = dm9000_start_xmit, .ndo_tx_timeout = dm9000_timeout, .ndo_set_rx_m
2015-12-08 17:32:02 680
原创 DM9000网卡驱动源码分析系列02 - 读写
下面列出的几段代码是dm9000驱动程序对一些常用的读写操作的封装,比如寄存器读写,IO内存块读写,eeprom读写,phy寄存器读写等等/* routines for sending block to chip */static void dm9000_outblk_8bit(void __iomem *reg, void *data, int count){ iowrite8_rep
2015-12-08 15:52:15 568
原创 DM9000网卡驱动源码分析系列04 - ethtool
/* ethtool ops */static void dm9000_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info){ struct board_info *dm = to_dm9000_board(dev); strlcpy(info->driver, CARDNAME, size
2015-12-08 14:18:15 688
原创 DM9000网卡驱动源码分析系列03 - probe && remove
static struct dm9000_plat_data *dm9000_parse_dt(struct device *dev){ struct dm9000_plat_data *pdata; struct device_node *np = dev->of_node; const void *mac_addr; if (!IS_ENABLED(CONFIG_OF) || !n
2015-12-08 08:56:26 1040
原创 DM9000网卡驱动源码分析系列01 - platform总线
驱动的作用是使能,让设备工作,如果是网卡设备,就是能通过网卡设备收发包对于内核来说有通用的收发包回调函数驱动开发人员为特定的网卡开发驱动程序,然后注册回调函数到内核,这样这个特定的设备就得到内核支持也就是说这个操作系统能通过这类网卡进行上网通信驱动的开发也是分层的每个设备都是自己特定的板级信息(board_info),这些信息包含生产商,生产编号,mac地址等等如果
2015-12-07 14:58:56 481
原创 DM9000网卡驱动源码分析系列00 - 初衷与目标
网络上已经有很多网友分析过dm9000网卡驱动了这次我分析dm9000的初衷是想了解一下底层收发包的一个流程所以我并不会纠结于网卡寄存器的操作,大概只是了解一下,操作什么寄存器进行读写另外我并没有花过多时间分析ethtool等工具的底层驱动支持我分析的核心部分是网卡驱动的框架以及收发包的中断处理流程dm9000这样一个相对简单的网卡驱动, 所有代码不到2000行,便于理
2015-12-07 14:51:04 398
DM9000_Application_Notes_Ver_1_22.pdf
2015-12-08
core java 第八版代码
2015-02-14
core java 第七版代码
2015-02-14
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人