summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2011-08-24Add bitfield access macrosSimon Glass
To use these, set things up like this: #define UART_PA_START 0x67000000 Physical address of UART struct uart_ctlr *uart = (struct uart_ctlr *)UART_PA_START; #define UART_FBCON_RANGE 5:3 Bit range for the FBCON field enum { An enum with allowed values UART_FBCON_OFF, UART_FBCON_ON, UART_FBCON_MULTI, UART_FBCON_SLAVE, }; This defines a bit field of 3 bits starting at bit 5 and extending down to bit 3, i.e. 5:3 Then: bitfield_unpack(UART_FBCON) - return the value of bits 5:3 (shifted down to bits 2:0) bitfield_pack(UART_FBCON, 4) - return a word with that field set to 4 (so in this case (4 << 3)) bitfield_set(UART_FBCON, word, val - update a field within word so that its value is val. bitfield_enum_writel(UART_FBCON, MULTI, &uart->fbcon) - set the UART's FBCON field to MULTI Change-Id: Id90aa0538093d67c917df2d744c0ebff1fe03b6f BUG=chromium-os:13875 TEST=cd test; make Review URL: http://codereview.chromium.org/6883058