Posts

Showing posts from June, 2010

Linux i2c

My notes while reading Linux kernel i2c source code and the documentation. i2c-dev implements the character devices for userspace, a generic, "remote controlled" i2c chip driver ioctl to select slave read()/write() for a subset of smbus operations i2c-tools with library functions i2c adapter A host bus adapter instance class - allow probing for slave devices in class: HWMON, TV, DDC, SPD nr - 'id' number of instance algo - operations to implement i2c_add_[numbered_]adapter() exported API i2c_transfer() - sequence of low level i2c operations i2c_smbus_transfer() - sequence of high level smbus operations i2c algorithm operations to implement a type of host bus adapter: bitbang, philips bus controllers master_xfer() - implement low level i2c transaction segment: operations to read or write bytes to/from i2c device smbus_xfer() - implement high level SMbus access functionality() - query available functionality: SMBUS support, 10bit addressing master_xfer can b

LDD3 notes: Networking

My notes while reading Linux Device Drivers 3rd edition , network drivers. General and setup Network devices have no /dev entry point different namespace file operations don't make sense on network interface. Why? I think they could. [alloc|register|unregister|free]_netdev alloc_netdev variants alloc_[eth|fc|fddi|tr]dev separate [ltalk|fc|fddi|hippi|tr]_setup private data not a pointer to driver allocated data, but allocated along with the net_device. supply size to allocate_netdev() use netdev_priv(dev) to access the data interface flags IFF_* flags & IFF_DEBUG, enable debuggin via ioctl: netifdebug IFF_UP change -> open()/stop() any flag change -> set_multicast_list() Features, interesting ones NETIF_F_NO_CSUM - interface needs no checksums NETIF_F_HW_CSUM - interface hardware does checksums NETIF_F_VLAN_[TX|RX|FILTER] NETIF_F_HIGHDMA by default all socket buffers are in low memory Networking device structure jiffy timestamps for last tx/rx, tx watchdog timeout. Transmi

Free UML tools

Excellent summary of freely available UML tools, with screenshots. http://www.devcurry.com/2010/06/free-open-source-uml-tools.html But it's missing the one I'm using the most: http://plantuml.sourceforge.net/

LDD3 notes: TTY

My notes while reading Linux Device Drivers 3rd edition , TTY drivers. TTY drivers are a generic implementation of a serial port interface with loose coupling of hardware access and data formatting. It is a char device composed of tty core for user space char device interface line discipline for data formatting tty driver for hardware access write can be called from interrupt context. must succeed for single byte write write buffer treatment put_char, flush_chars - start sending them, return right away wait_until_sent - start sending, wait until done or timeout flush_buffer - discard write buffered chars. read tty_insert_flip_char() for each char tty_flip_buffer_push() whenever count reaches size at the end of sequence set_termios() 38400,8n1 -style serial settings handshake mechanism selection tiocm{g|s}et() access control lines ioctl() tty driver first, except break fallback to inherit core functionality with -ENOICTLCMD Get Line Status Register LSR: data, overrun, parity, framing, b

iMovie event library on a network drive, NAS

I was shocked to find that iMovie '09 would not allow storing event libraries on networked disks. The AFP volume would show up, but remain non-functional with a yellow exclamation sign. There are plenty of instructions for hacking around the limitation with clumsy symbolic links. I discovered a much simpler approach, using an undocumented (?) setting built right into iMovie:"Allow Network Volumes". Use at your own risk, try the following command in Terminal defaults write -app iMovie allowNV -bool true

Mac Time Machine with Linux server

Finally, an easy way to have Time Machine accept a Linux server as a backup disk. Upgrade to Ubuntu 10.4 . Install netatalk Add option "tm" to a share in AppleVolumes.default config file. No need to mess with Manually created sparsebundles Shoehorn settings like TMShowUnsupportedNetworkVolumes The key is to have netatalk version 2.0.5 or above.

LDD3 notes: DMA

My notes while reading Linux Device Drivers 3rd edition , Memory mapping and DMA. Kernel addressing Physical address Logical Address Virtual address Bus address (physical address as understood by the DMA peripheral) __pa() , __va() for low memory only Concepts PFN - page frame number. (virtual or physical) address / page size struct page 'handle' to a page of memory. page_address() macro to get virtual address, if mapped kmap() kernel virtual address for any page in the system may sleep, but has an atomic version VMA - virtual memory area. a contiguous, homogeneous region of process virtual address space. visible in /proc/pid/maps vm_area_struct nopage() - process accessed a missing page, go get it vm_pgoff, offset in pages into the backing file mm_struct - a list of virtual memory areas for a single process. threads may share one. implementing mmap remap_pfn_range(), once and for all ( io_remap_page_range() ) - reserved pages only: locked in memory, outside of memory ma