Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing errata 12 on master branch #172

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fixing errata 12 on master branch #172

wants to merge 1 commit into from

Conversation

samiralavi
Copy link

No description provided.

@sakugava
Copy link

sakugava commented Jan 5, 2017

while (((eir = readReg(EIR)). Is it correct?

@samiralavi
Copy link
Author

Yes it is,
(((eir = readReg(EIR)) & (EIR_TXIF | EIR_TXERIF)) == 0)
we have 3 separate conditions,
first : (eir = readReg(EIR))
it puts the read result into eir and then eir is returned
second : (EIR_TXIF | EIR_TXERIF)
third : And of these two conditions
(((eir = readReg(EIR)) & (EIR_TXIF | EIR_TXERIF)) == 0)
Also we can change it to be more clear :
(((eir = readReg(EIR)) & (EIR_TXIF | EIR_TXERIF)) == false)
or
(!((eir = readReg(EIR)) & (EIR_TXIF | EIR_TXERIF)))

@samiralavi
Copy link
Author

samiralavi commented Jan 5, 2017

I once had a problem that when I would connect a ENC28j60 board to raspberry pi directly, after some time the IC would be stuck. After a lot of search, I finally made it work, by adding this fix to master branch.

@Benjamin-Langlois
Copy link

while (((eir = readReg(EIR)) & (EIR_TXIF | EIR_TXERIF)) == 0)

always results in 0 because:

(EIR_TXIF | EIR_TXERIF) == (2 | 8) == 10

and (X & 10) == 0

Shouldn't it be && instead of &?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants