summaryrefslogtreecommitdiff
path: root/drivers/gpio
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2011-04-21 09:49:19 -0700
committerSimon Glass <sjg@chromium.org>2011-08-24 09:54:51 -0700
commita8447b71421e024fbbb0842cb7c54ff5b95c0eed (patch)
treefed477180143ae0924ef31837fce41d065bcec4a /drivers/gpio
parent496d8d9f9c85cae0ddde05286c7b27604d8fc2d7 (diff)
Add bitfield access macros
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
Diffstat (limited to 'drivers/gpio')
0 files changed, 0 insertions, 0 deletions