Skip to content

Commit

Permalink
Merge pull request #47 from rahul-mr/small_fix1
Browse files Browse the repository at this point in the history
memory.lua: rename chunk_phys to chunk_phy ; intel.lua: set rdt = 0 in init_receive() , set tdt = 0 in init_transmit()
  • Loading branch information
lukego committed Jan 22, 2013
2 parents 31a8df3 + c346ae2 commit edda21a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/intel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ function new (pciaddress)

local rxnext = 0
local rxbuffers = {}
local rdt = 0

function init_receive ()
-- Disable RX and program all the registers
Expand All @@ -286,10 +287,9 @@ function new (pciaddress)
rxnext = 0
-- Enable RX
regs[RCTL] = bit.bor(regs[RCTL], bits{EN=1})
rdt = 0
end

local rdt = 0

-- Enqueue a receive descriptor to receive a packet.
local function add_rxbuf (address)
-- NOTE: RDT points to the next unused descriptor
Expand Down Expand Up @@ -347,6 +347,11 @@ function new (pciaddress)

-- Transmit functionality

-- Locally cached copy of the Transmit Descriptor Tail (TDT) register.
-- Updates are kept locally here until flush_tx() is called.
-- That's because updating the hardware register is relatively expensive.
local tdt = 0

function init_transmit ()
regs[TCTL] = 0x3103f0f8
regs[TXDCTL] = 0x01410000
Expand All @@ -357,7 +362,7 @@ function new (pciaddress)
regs[TDT] = 0
regs[TXDCTL] = 0x01410000
regs[TCTL] = 0x3103f0fa

tdt = 0
end

function init_transmit_ring ()
Expand All @@ -368,11 +373,6 @@ function new (pciaddress)
regs[TDLEN] = num_descriptors * ffi.sizeof("union tx")
end

-- Locally cached copy of the Transmit Descriptor Tail (TDT) register.
-- Updates are kept locally here until flush_tx() is called.
-- That's because updating the hardware register is relatively expensive.
local tdt = 0

-- Flags for transmit descriptors.
local txdesc_flags = bits({dtype=20, eop=24, ifcs=25, dext=29})

Expand Down
2 changes: 1 addition & 1 deletion src/memory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ local C = ffi.C
--- allocations.

-- Current chunk: pointer, physical address, remaining size.
local chunk_ptr, chunk_phys, chunk_size
local chunk_ptr, chunk_phy, chunk_size

-- Install a new chunk of memory at a specific physical memory address.
-- Mostly useful if you have reserved memory using 'linux memmap=16M$0x10000000'
Expand Down

0 comments on commit edda21a

Please sign in to comment.