Ronald G. Minnich | 5b582f2 | 2006-02-23 17:16:44 +0000 | [diff] [blame] | 1 | #ifndef __SHARPLHF00L04_H__ |
| 2 | #define __SHARPLHF00L04_H__ 1 |
| 3 | |
| 4 | extern int probe_lhf00l04(struct flashchip *flash); |
| 5 | extern int erase_lhf00l04(struct flashchip *flash); |
| 6 | extern int write_lhf00l04(struct flashchip *flash, uint8_t *buf); |
Ronald G. Minnich | 5eaed68 | 2006-03-14 19:58:14 +0000 | [diff] [blame] | 7 | extern __inline__ void toggle_ready_lhf00l04(volatile uint8_t *dst) |
| 8 | { |
| 9 | unsigned int i = 0; |
| 10 | uint8_t tmp1, tmp2; |
| 11 | |
| 12 | tmp1 = *dst & 0x40; |
| 13 | |
| 14 | while (i++ < 0xFFFFFF) { |
| 15 | tmp2 = *dst & 0x40; |
| 16 | if (tmp1 == tmp2) { |
| 17 | break; |
| 18 | } |
| 19 | tmp1 = tmp2; |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | extern __inline__ void data_polling_lhf00l04(volatile uint8_t *dst, uint8_t data) |
| 24 | { |
| 25 | unsigned int i = 0; |
| 26 | uint8_t tmp; |
| 27 | |
| 28 | data &= 0x80; |
| 29 | |
| 30 | while (i++ < 0xFFFFFF) { |
| 31 | tmp = *dst & 0x80; |
| 32 | if (tmp == data) { |
| 33 | break; |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | extern __inline__ void protect_lhf00l04(volatile uint8_t *bios) |
| 39 | { |
| 40 | *(volatile uint8_t *) (bios + 0x5555) = 0xAA; |
| 41 | *(volatile uint8_t *) (bios + 0x2AAA) = 0x55; |
| 42 | *(volatile uint8_t *) (bios + 0x5555) = 0xA0; |
| 43 | |
| 44 | usleep(200); |
| 45 | } |
Ronald G. Minnich | 5b582f2 | 2006-02-23 17:16:44 +0000 | [diff] [blame] | 46 | |
| 47 | #endif /* !__SHARPLHF00L04_H__ */ |