Drivers for the MNT ZZ9000 graphics and ARM coprocessor card for classic Amigas.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

150 lines
4.0 KiB

  1. /*
  2. * MNT ZZ9000 Network Driver (ZZ9000Net.device)
  3. * Copyright (C) 2016-2019, Lukas F. Hartmann <lukas@mntre.com>
  4. * MNT Research GmbH, Berlin
  5. * https://mntre.com
  6. * Copyright (C) 2018 Henryk Richter <henryk.richter@gmx.net>
  7. *
  8. * More Info: https://mntre.com/zz9000
  9. *
  10. * SPDX-License-Identifier: GPL-3.0-or-later
  11. * GNU General Public License v3.0 or later
  12. *
  13. * https://spdx.org/licenses/GPL-3.0-or-later.html
  14. */
  15. /*
  16. device.h
  17. (C) 2018 Henryk Richter <henryk.richter@gmx.net>
  18. Device Functions and Definitions
  19. */
  20. #ifndef _INC_DEVICE_H
  21. #define _INC_DEVICE_H
  22. /* defaults */
  23. #define MAX_UNITS 4
  24. /* includes */
  25. #include "compiler.h"
  26. #include <dos/dos.h>
  27. #include <exec/lists.h>
  28. #include <exec/libraries.h>
  29. #include <exec/devices.h>
  30. #include <exec/semaphores.h>
  31. #include "debug.h"
  32. #include "sana2.h"
  33. /* reassign Library bases from global definitions to own struct */
  34. #define SysBase db->db_SysBase
  35. #define DOSBase db->db_DOSBase
  36. #define UtilityBase db->db_UtilityBase
  37. #define ExpansionBase db->db_ExpansionBase
  38. struct DevUnit {
  39. /* HW Data (generic for now) (example only, unused in construct)*/
  40. ULONG du_hwl0;
  41. ULONG du_hwl1;
  42. ULONG du_hwl2;
  43. APTR du_hwp0;
  44. APTR du_hwp1;
  45. APTR du_hwp2;
  46. };
  47. #define DEVF_INT2MODE (1L << 0)
  48. struct devbase {
  49. struct Library db_Lib;
  50. BPTR db_SegList; /* from Device Init */
  51. ULONG db_Flags; /* misc */
  52. struct Library *db_SysBase; /* Exec Base */
  53. struct Library *db_DOSBase;
  54. struct Library *db_UtilityBase;
  55. struct Library *db_ExpansionBase;
  56. struct Interrupt *db_interrupt;
  57. struct List db_ReadList;
  58. struct SignalSemaphore db_ReadListSem;
  59. struct Process* db_Proc;
  60. struct SignalSemaphore db_ProcExitSem;
  61. struct DevUnit db_Units[MAX_UNITS]; /* unused in construct */
  62. };
  63. #ifndef DEVBASETYPE
  64. #define DEVBASETYPE struct devbase
  65. #endif
  66. #ifndef DEVBASEP
  67. #define DEVBASEP DEVBASETYPE *db
  68. #endif
  69. /* PROTOS */
  70. ASM LONG LibNull( void );
  71. ASM SAVEDS struct Device *DevInit(ASMR(d0) DEVBASEP ASMREG(d0),
  72. ASMR(a0) BPTR seglist ASMREG(a0),
  73. ASMR(a6) struct Library *_SysBase ASMREG(a6) );
  74. ASM SAVEDS LONG DevOpen( ASMR(a1) struct IOSana2Req *ios2 ASMREG(a1),
  75. ASMR(d0) ULONG unit ASMREG(d0),
  76. ASMR(d1) ULONG flags ASMREG(d1),
  77. ASMR(a6) DEVBASEP ASMREG(a6) );
  78. ASM SAVEDS BPTR DevClose( ASMR(a1) struct IORequest *ios2 ASMREG(a1),
  79. ASMR(a6) DEVBASEP ASMREG(a6) );
  80. ASM SAVEDS BPTR DevExpunge( ASMR(a6) DEVBASEP ASMREG(a6) );
  81. ASM SAVEDS VOID DevBeginIO( ASMR(a1) struct IOSana2Req *ios2 ASMREG(a1),
  82. ASMR(a6) DEVBASEP ASMREG(a6) );
  83. ASM SAVEDS LONG DevAbortIO( ASMR(a1) struct IORequest *ios2 ASMREG(a1),
  84. ASMR(a6) DEVBASEP ASMREG(a6) );
  85. void DevTermIO( DEVBASETYPE*, struct IORequest * );
  86. /* private functions */
  87. #ifdef DEVICE_MAIN
  88. //static void dbNewList( struct List * );
  89. //static LONG dbIsInList( struct List *, struct Node * );
  90. #endif /* DEVICE_MAIN */
  91. #define HW_ADDRFIELDSIZE 6
  92. #define HW_ETH_HDR_SIZE 14 /* ethernet header: dst, src, type */
  93. #define HW_ETH_MTU 1500
  94. typedef BOOL (*BMFunc)(__reg("a0") void* a, __reg("a1") void* b, __reg("d0") long c);
  95. typedef struct BufferManagement
  96. {
  97. struct MinNode bm_Node;
  98. BMFunc bm_CopyFromBuffer;
  99. BMFunc bm_CopyToBuffer;
  100. } BufferManagement;
  101. struct HWFrame {
  102. USHORT hwf_Size;
  103. /* use layout of ethernet header here */
  104. UBYTE hwf_DstAddr[HW_ADDRFIELDSIZE];
  105. UBYTE hwf_SrcAddr[HW_ADDRFIELDSIZE];
  106. USHORT hwf_Type;
  107. /*UBYTE hwf_Data[MTU];*/
  108. };
  109. const struct InitTable
  110. {
  111. ULONG LibBaseSize;
  112. APTR FunctionTable;
  113. APTR DataTable;
  114. APTR InitLibTable;
  115. };
  116. #endif /* _INC_DEVICE_H */