bfin_mac.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * bfin_mac.h - some defines/structures for the Blackfin on-chip MAC.
  3. *
  4. * Copyright (c) 2005-2008 Analog Device, Inc.
  5. *
  6. * Licensed under the GPL-2 or later.
  7. */
  8. #ifndef __BFIN_MAC_H__
  9. #define __BFIN_MAC_H__
  10. #define RECV_BUFSIZE (0x614)
  11. typedef struct ADI_DMA_CONFIG_REG {
  12. u16 b_DMA_EN:1; /* 0 Enabled */
  13. u16 b_WNR:1; /* 1 Direction */
  14. u16 b_WDSIZE:2; /* 2:3 Transfer word size */
  15. u16 b_DMA2D:1; /* 4 DMA mode */
  16. u16 b_RESTART:1; /* 5 Retain FIFO */
  17. u16 b_DI_SEL:1; /* 6 Data interrupt timing select */
  18. u16 b_DI_EN:1; /* 7 Data interrupt enabled */
  19. u16 b_NDSIZE:4; /* 8:11 Flex descriptor size */
  20. u16 b_FLOW:3; /* 12:14Flow */
  21. } ADI_DMA_CONFIG_REG;
  22. typedef struct adi_ether_frame_buffer {
  23. u16 NoBytes; /* the no. of following bytes */
  24. u8 Dest[6]; /* destination MAC address */
  25. u8 Srce[6]; /* source MAC address */
  26. u16 LTfield; /* length/type field */
  27. u8 Data[0]; /* payload bytes */
  28. } ADI_ETHER_FRAME_BUFFER;
  29. /* 16 bytes/struct */
  30. typedef struct dma_descriptor {
  31. struct dma_descriptor *NEXT_DESC_PTR;
  32. u32 START_ADDR;
  33. union {
  34. u16 CONFIG_DATA;
  35. ADI_DMA_CONFIG_REG CONFIG;
  36. };
  37. } DMA_DESCRIPTOR;
  38. /* 10 bytes/struct in 12 bytes */
  39. typedef struct adi_ether_buffer {
  40. DMA_DESCRIPTOR Dma[2]; /* first for the frame, second for the status */
  41. ADI_ETHER_FRAME_BUFFER *FrmData;/* pointer to data */
  42. struct adi_ether_buffer *pNext; /* next buffer */
  43. struct adi_ether_buffer *pPrev; /* prev buffer */
  44. u16 IPHdrChksum; /* the IP header checksum */
  45. u16 IPPayloadChksum; /* the IP header and payload checksum */
  46. volatile u32 StatusWord; /* the frame status word */
  47. } ADI_ETHER_BUFFER;
  48. /* 40 bytes/struct in 44 bytes */
  49. static ADI_ETHER_BUFFER *SetupRxBuffer(int no);
  50. static ADI_ETHER_BUFFER *SetupTxBuffer(int no);
  51. static int bfin_EMAC_init(struct eth_device *dev, bd_t *bd);
  52. static void bfin_EMAC_halt(struct eth_device *dev);
  53. static int bfin_EMAC_send(struct eth_device *dev, void *packet, int length);
  54. static int bfin_EMAC_recv(struct eth_device *dev);
  55. static int bfin_EMAC_setup_addr(struct eth_device *dev);
  56. #endif