Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

nic.h 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * This program is free software; you can redistribute it and/or
  3. * modify it under the terms of the GNU General Public License as
  4. * published by the Free Software Foundation; either version 2, or (at
  5. * your option) any later version.
  6. */
  7. #ifndef NIC_H
  8. #define NIC_H
  9. typedef enum {
  10. DISABLE = 0,
  11. ENABLE,
  12. FORCE
  13. } irq_action_t;
  14. /*
  15. * Structure returned from eth_probe and passed to other driver
  16. * functions.
  17. */
  18. struct nic {
  19. struct nic_operations *nic_op;
  20. int flags; /* driver specific flags */
  21. unsigned char *node_addr;
  22. unsigned char *packet;
  23. unsigned int packetlen;
  24. unsigned int ioaddr;
  25. unsigned char irqno;
  26. void *priv_data; /* driver can hang private data here */
  27. };
  28. struct nic_operations {
  29. int ( *connect ) ( struct nic * );
  30. int ( *poll ) ( struct nic *, int retrieve );
  31. void ( *transmit ) ( struct nic *, const char *,
  32. unsigned int, unsigned int, const char * );
  33. void ( *irq ) ( struct nic *, irq_action_t );
  34. void ( *disable ) ( struct nic * );
  35. };
  36. /*
  37. * Function prototypes
  38. *
  39. */
  40. struct dev;
  41. extern struct nic * nic_device ( struct dev * dev );
  42. /*
  43. * Functions that implicitly operate on the current boot device
  44. *
  45. * "nic" always points to &dev.nic
  46. */
  47. extern struct nic *nic;
  48. static inline int eth_connect ( void ) {
  49. return nic->nic_op->connect ( nic );
  50. }
  51. static inline int eth_poll ( int retrieve ) {
  52. return nic->nic_op->poll ( nic, retrieve );
  53. }
  54. static inline void eth_transmit ( const char *dest, unsigned int type,
  55. unsigned int size, const void *packet ) {
  56. nic->nic_op->transmit ( nic, dest, type, size, packet );
  57. }
  58. static inline void eth_irq ( irq_action_t action ) {
  59. nic->nic_op->irq ( nic, action );
  60. }
  61. /* Should be using disable() rather than eth_disable() */
  62. static inline void eth_disable ( void ) __attribute__ (( deprecated ));
  63. static inline void eth_disable ( void ) {
  64. nic->nic_op->disable ( nic );
  65. }
  66. /* dev.h needs declarations from nic.h */
  67. #include "dev.h"
  68. /* to get global "dev" */
  69. #include "main.h"
  70. #endif /* NIC_H */