OpenCores
URL https://opencores.org/ocsvn/gecko3/gecko3/trunk

Subversion Repositories gecko3

[/] [gecko3/] [trunk/] [GECKO3COM/] [gecko3com-fw/] [firmware/] [include/] [usb_tmc.h] - Diff between revs 9 and 32

Show entire file | Details | Blame | View Log

Rev 9 Rev 32
Line 49... Line 49...
#define USB_TMC_HEADER_SIZE 12  /**< length of a USBTMC header */
#define USB_TMC_HEADER_SIZE 12  /**< length of a USBTMC header */
 
 
 
 
/* USBTMC MsgID. Values, Ref.: Table 2 */
/* USBTMC MsgID. Values, Ref.: Table 2 */
#define DEV_DEP_MSG_OUT              1   /**< device dependent command message */
#define DEV_DEP_MSG_OUT              1   /**< device dependent command message */
#define REQUEST_DEV_DEP_MSG_IN       2   /**< command message that requests the device to send a USBTMC response */
#define REQUEST_DEV_DEP_MSG_IN      2   /**< command message that requests the 
#define DEV_DEP_MSG_IN               2   /**< response message to the REQUEST_DEV_DEP_MSG_IN */
                                           device to send a USBTMC response */
 
#define DEV_DEP_MSG_IN              2   /**< response message to the 
 
                                           REQUEST_DEV_DEP_MSG_IN */
#define VENDOR_SPECIFIC_OUT          126 /**< vendor specific command message */
#define VENDOR_SPECIFIC_OUT          126 /**< vendor specific command message */
#define REQUEST_VENDOR_SPECIFIC_IN   127 /**< command message that requests the device to send a vendor specific USBTMC response */
#define REQUEST_VENDOR_SPECIFIC_IN  127 /**< command message that requests the
#define VENDOR_SPECIFIC_IN           127 /**< response message to the REQUEST_VENDOR_SPECIFIC_IN */
                                           device to send a vendor specific
 
                                           USBTMC response */
 
#define VENDOR_SPECIFIC_IN          127 /**< response message to the 
 
                                           REQUEST_VENDOR_SPECIFIC_IN */
 
 
 
 
/* format of bmRequestType byte */
/* format of bmRequestType byte */
#define bmRT_TMC_OUT   0x21             
#define bmRT_TMC_OUT   0x21             
#define bmRT_TMC_IN    0xA1
#define bmRT_TMC_IN    0xA1
Line 135... Line 140...
typedef struct
typedef struct
{
{
        uint32_t TransferSize;
        uint32_t TransferSize;
        int8_t   bmTransferAttributes;
        int8_t   bmTransferAttributes;
        int8_t   Reserved[3];
        int8_t   Reserved[3];
} DEV_DEP_MSG_OUT_Header, /**< \brief Bulk-OUT Header for a DEV_DEP_MSG, Ref.: Table 3 */
} DEV_DEP_MSG_OUT_Header, /**< Bulk-OUT Header for a DEV_DEP_MSG,
  DEV_DEP_MSG_IN_Header;  /**< \brief Bulk-IN Header for a DEV_DEP_MSG, Ref.: Table 9 */
                            Ref.: Table 3 */
 
  DEV_DEP_MSG_IN_Header;  /**< Bulk-IN Header for a DEV_DEP_MSG,
 
                             Ref.: Table 9 */
 
 
/** \brief Structure to handle USBTMC device dependent message IN requests.
/** \brief Structure to handle USBTMC device dependent message IN requests.
 *
 *
 *  Ref.: Table 4 */
 *  Ref.: Table 4 */
typedef struct
typedef struct
Line 155... Line 162...
 *  to USBTMC */
 *  to USBTMC */
typedef struct
typedef struct
{
{
        uint32_t TransferSize;
        uint32_t TransferSize;
        int8_t   Reserved[4];
        int8_t   Reserved[4];
} VENDOR_SPECIFIC_OUT_Header, /**< \brief structure to handle vendor specific
} VENDOR_SPECIFIC_OUT_Header, /**< structure to handle vendor specific
                               *IN/OUT or REQUESTS according to Ref.: Table 5 */
                               *IN/OUT or REQUESTS according to Ref.: Table 5 */
  REQUEST_VENDOR_SPECIFIC_IN_Header, /**< \brief structure to handle vendor
  REQUEST_VENDOR_SPECIFIC_IN_Header, /**< structure to handle vendor
                                      * specific IN/OUT or REQUESTS according
                                      * specific IN/OUT or REQUESTS according
                                      * Ref.: Table 6 */
                                      * Ref.: Table 6 */
  VENDOR_SPECIFIC_IN_Header; /**< \brief structure to handle vendor specific
  VENDOR_SPECIFIC_IN_Header; /**< structure to handle vendor specific
                              * IN/OUT or REQUESTS according Ref.: Table 10 */
                              * IN/OUT or REQUESTS according Ref.: Table 10 */
 
 
/** \brief general Header structure for USBTMC bulk messages. The MsgID value
/** \brief general Header structure for USBTMC bulk messages. The MsgID value
 *  determines the type of the msg_specific part of these structure */
 *  determines the type of the msg_specific part of these structure */
typedef struct _tHeader
typedef struct _tHeader
Line 223... Line 230...
 
 
/** \brief struct to hold all usb tmc transfer relevant information */
/** \brief struct to hold all usb tmc transfer relevant information */
typedef struct {
typedef struct {
  uint8_t bTag; /**< contains the bTag value of the currently active transfer */
  uint8_t bTag; /**< contains the bTag value of the currently active transfer */
  uint32_t transfer_size;
  uint32_t transfer_size;
  uint8_t new_transfer; /**< flag to signal the start of a new transfer, else 0 */
  uint8_t new_transfer; /**< flag to signal the start of a new transfer,
  uint32_t nbytes_rxd; /**< contains the number of bytes received in active tmc OUT transfer */
                           else 0 */
  uint32_t nbytes_txd; /**< contains the number of bytes transmitted in active tmc IN transfer */
  uint32_t nbytes_rxd; /**< contains the number of bytes received in active
 
                          tmc OUT transfer */
 
  uint32_t nbytes_txd; /**< contains the number of bytes transmitted in active
 
                          tmc IN transfer */
 
 
} TMC_Transfer_Info;
} TMC_Transfer_Info;
 
 
 
 
/** \brief response queue to hold the data for requests */
/** \brief response queue to hold the data for requests */
Line 238... Line 248...
  uint16_t length;  /**< length of message. is 0 when no message is available */
  uint16_t length;  /**< length of message. is 0 when no message is available */
} TMC_Response_Queue;
} TMC_Response_Queue;
 
 
 
 
/* Global variables */
/* Global variables */
extern volatile static TMC_Status usb_tmc_status;       /**< Global variable contains the status of the last tmc operation. normally USB_TMC_SUCCESS */
extern volatile static TMC_Status usb_tmc_status;       /**< Global variable
extern volatile TMC_State usb_tmc_state;         /**< Global variable contains the state of the tmc system. Example USB_TMC_IDLE or USB_TMC_IN_TRANSFER */
contains the status of the last tmc operation. normally USB_TMC_SUCCESS */
extern volatile idata TMC_Transfer_Info usb_tmc_transfer; /** Global struct to hold all usb tmc transfer relevant information */
extern volatile TMC_State usb_tmc_state;         /**< Global variable contains
extern volatile idata IEEE488_status_registers ieee488_status;   /**< Struct that contains all status and enable registers for the IEEE488 status reporting capabilities */
the state of the tmc system. Example USB_TMC_IDLE or USB_TMC_IN_TRANSFER */
 
extern volatile idata TMC_Transfer_Info usb_tmc_transfer; /**< Global struct
 
to hold all usb tmc transfer relevant information */
 
extern volatile idata IEEE488_status_registers ieee488_status;   /**< Struct
 
that contains all status and enable registers for the IEEE488 status reporting
 
capabilities */
 
 
 
 
/** Makro to check if this setup package is a USBTMC request */
/** Makro to check if this setup package is a USBTMC request */
#define usb_tmc_request() ((wIndexL == USB_TMC_INTERFACE && \
#define usb_tmc_request() ((wIndexL == USB_TMC_INTERFACE && \
                            (bRequestType & bmRT_RECIP_INTERFACE) == bmRT_RECIP_INTERFACE) \
                            (bRequestType & bmRT_RECIP_INTERFACE) == bmRT_RECIP_INTERFACE) \
Line 267... Line 282...
 
 
 
 
/** \brief clears all global variables to known states. sets the POWER_ON bit */
/** \brief clears all global variables to known states. sets the POWER_ON bit */
void init_usb_tmc();
void init_usb_tmc();
 
 
/** set the mav bit (Message available or "Queue not empty") in the IEEE488 status structure */
/** set the mav bit (Message available or "Queue not empty") in the IEEE488
 
    status structure */
#define IEEE488_set_mav() (ieee488_status.StatusByteRegister |= 0x10)
#define IEEE488_set_mav() (ieee488_status.StatusByteRegister |= 0x10)
 
 
/** clear the mav bit (Message available or "Queue not empty") in the IEEE488 status structure */
/** clear the mav bit (Message available or "Queue not empty") in the IEEE488
 
    status structure */
#define IEEE488_clear_mav() (ieee488_status.StatusByteRegister &= 0xEF)
#define IEEE488_clear_mav() (ieee488_status.StatusByteRegister &= 0xEF)
 
 
/** \brief evalutates the status IEEE488 status byte. represents the current
/** \brief evalutates the status IEEE488 status byte. represents the current
 *         device state
 *         device state
 *
 *
Line 286... Line 303...
 *            Status byte in the struct is updated
 *            Status byte in the struct is updated
 * \return return value is the current value of the status byte
 * \return return value is the current value of the status byte
 */
 */
uint8_t IEEE488_status_query(idata IEEE488_status_registers *status);
uint8_t IEEE488_status_query(idata IEEE488_status_registers *status);
 
 
#endif
#endif /* _USBTMC_H_ */
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.