Main Page Data Structures File List Data Fields Globals Related Pages

# clib/PKTDRV.H

Go to the documentation of this file.

    00001 /****************************************************************************
    00002 *
    00003 * (C) 2000 by BECK IPC GmbH
    00004 *
    00005 *  BECK IPC GmbH
    00006 *  Garbenheimerstr. 38
    00007 *  D-35578 Wetzlar
    00008 *
    00009 *  Phone : (49)-6441-905-240
    00010 *  Fax   : (49)-6441-905-245
    00011 *
    00012 * ---------------------------------------------------------------------------
    00013 * Module        : IPC@CHIP SC12 API: PKTDRV.H
    00014 * Function      : Headerfile
    00015                   Packet driver interface enables access to the ethernet of SC12
    00016 *                 Required memory model: Large
    00017 *
    00018 * Author        : Bartat
    00019 * Date          : 10.10.00
    00020 * ---------------------------------------------------------------------------
    00021
    00022 $Header: PKTDRV.H, 7, 16.01.2002 11:45:05, Christoph Stoidner$
    00023
    00024 $Log:
    00025  7    IPC@CHIP  1.6         16.01.2002 11:45:05  Christoph Stoidner add starteam
    00026       directives
    00027  6    IPC@CHIP  1.5         16.01.2002 11:04:49  Christoph Stoidner add some
    00028       comments
    00029
    00030  5    IPC@CHIP  1.4         14.12.2001 12:15:49  Markus Bartat   added
    00031       set_rcv_mode functions
    00032  4    IPC@CHIP  1.3         17.09.2001 11:19:41  Markus Bartat   added new
    00033       functions for wildcard and multicast api calls
    00034  3    IPC@CHIP  1.2         19.06.2001 13:35:06  Markus Bartat   start: Added
    00035       comments to the c functions
    00036  2    IPC@CHIP  1.1         15.02.2001 15:16:52  Christoph Stoidner
    00037  1    IPC@CHIP  1.0         14.02.2001 16:09:33  Christoph Stoidner
    00038 $
    00039
    00040 * History       :
    00041 *
    00042 *  Vx.yy                 Author  Changes
    00043 *
    00044 *             10.10.00   mb      Create
    00045 *             12.09.01   mb       added multicast and wildcard_access  functions
    00046 *             06.12.01   mb       added set_rcv_mode functions
    00047 /**************************************************************************/
    00048 #ifndef _PKT_DRV_H_
    00049 #define _PKT_DRV_H_
    00050
    00051 /**************************************************************************/
    00052 //          DEFINES
    00053 /**************************************************************************/
    00054 #ifdef _MSC_VER /* If Microsoft C Compiler is used, define new FP_SEG and FP_OFF Macro */
    00055   #ifdef FP_SEG
    00056       #undef FP_SEG
    00057   #endif
    00058   #define FP_SEG(ptr)    ((unsigned int)(((unsigned long)ptr)>>16))
    00059
    00060   #ifdef FP_OFF
    00061       #undef FP_OFF
    00062   #endif
    00063   #define FP_OFF(ptr)    ((unsigned int)(((unsigned long)ptr)&0xFFFF))
    00064 #endif
    00065
    00066
    00067 #define PKTVECT  0xAE
    00068
    00069 //frame size
    00070 #define SIZE_ETH_HEADER    (int)14
    00071 #define ETH_MIN            (int)64
    00072 #define ETH_MAX            (int)1500
    00073
    00074
    00075
    00076
    00077 /* Packet driver error return codes */
    00078 #define NO_ERROR  0
    00079 #define BAD_HANDLE  1 /* invalid handle number */
    00080 #define BAD_TYPE  5 /* bad packet type specified */
    00081 #define NO_SPACE  9 /* operation failed because of insufficient space */
    00082 #define TYPE_INUSE  10  /* the type had previously been accessed, and not released */
    00083 #define BAD_COMMAND 11  /* the command was out of range, or not implemented */
    00084 #define CANT_SEND 12  /* the packet couldn't be sent (usually hardware error) */
    00085
    00086
    00087 /* Packet driver function call numbers */
    00088 #define DRIVER_INFO   1
    00089 #define ACCESS_TYPE   2
    00090 #define RELEASE_TYPE          3
    00091 #define SEND_PKT    4
    00092 #define GET_ADDRESS   6
    00093 #define SET_RCVMODE     20
    00094 #define GET_RCVMODE     21
    00095 #define SET_MULTICAST 22     /*set/add multicast mac address*/
    00096 #define DEL_MULTICAST 39     /*remove multicast mac address*/
    00097 #define INSTALL_WILDCARD 40
    00098
    00099
    00100 /************************************************************************/
    00101 //               typedefinitions
    00102 /************************************************************************/
    00103
    00104 //ethernet frame
    00105 typedef struct tag_ethernet_packet_format
    00106 {
    00107     unsigned char dest[6];
    00108     unsigned char src[6];
    00109     unsigned int  type;
    00110     unsigned char data[1500];
    00111 }Eth_Packet;
    00112
    00113
    00114 typedef union union_eth
    00115 {
    00116     Eth_Packet     packstruc;
    00117     unsigned char  packet[sizeof(Eth_Packet)];
    00118 }Ethernet_Packet;
    00119
    00120
    00121
    00122
    00123 //driver info
    00124 typedef struct tag_driver_info
    00125 {
    00126    unsigned char basic;
    00127    unsigned char _class;
    00128    unsigned char number;
    00129    unsigned int type;
    00130    unsigned int version;
    00131 }Driver_Info;
    00132
    00133
    00134
    00135
    00136 typedef void (far *fpFktPtr)();
    00137
    00138
    00139
    00140
    00141 /************************************************************************/
    00142 //prototypes
    00143 /************************************************************************/
    00144 unsigned char PktDriver_Installed(void);
    00145 unsigned char Get_Driver_Info(Driver_Info * drv_info );
    00146 unsigned char Get_Eth_Address(unsigned char *buffer, unsigned int len);
    00147 unsigned char Send_Packet(unsigned char * buffer, unsigned int len);
    00148 unsigned int Set_Access_Type(Driver_Info * drv_info, fpFktPtr Receiver, int * pkt_type, int *handle);
    00149 unsigned int Release_Type(unsigned int handle);
    00150 unsigned int Set_Multicast(unsigned char * mac_addr, int set);
    00151 unsigned int Set_WildcardAccess_Type(Driver_Info * drv_info, fpFktPtr Receiver, int * pkt_type, int *handle);
    00152 unsigned int Get_Receive_Mode(unsigned char * error);
    00153 unsigned int Set_Receive_Mode(unsigned int mode,unsigned char * error);
    00154 /************************************************************************/
    00155 #endif
    00156 /************************************************************************/
    00157 //end pktdrv.h
    00158 /************************************************************************/