Macros | Fonctions
Référence du fichier samd21_host.c
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "../Arduino.h"
#include "variant.h"
#include "USB_host.h"
#include "samd21_host.h"
#include "sam.h"
#include "wiring_digital.h"
#include "wiring_private.h"

Macros

#define HOST_DEFINED
 
#define TRACE_UOTGHS_HOST(x)
 
#define NVM_USB_PAD_TRANSN_POS   45
 
#define NVM_USB_PAD_TRANSN_SIZE   5
 
#define NVM_USB_PAD_TRANSP_POS   50
 
#define NVM_USB_PAD_TRANSP_SIZE   5
 
#define NVM_USB_PAD_TRIM_POS   55
 
#define NVM_USB_PAD_TRIM_SIZE   3
 

Fonctions

 __attribute__ ((__aligned__(4))) volatile
 Initialize the SAMD21 host driver. Plus de détails...
 
void UHD_Handler (void)
 Interrupt sub routine for USB Host state machine management. Plus de détails...
 
uhd_vbus_state_t UHD_GetVBUSState (void)
 Get VBUS state. Plus de détails...
 
uint32_t UHD_Pipe0_Alloc (uint32_t ul_add, uint32_t ul_ep_size)
 Allocate FIFO for pipe 0. Plus de détails...
 
uint32_t UHD_Pipe_Alloc (uint32_t ul_dev_addr, uint32_t ul_dev_ep, uint32_t ul_type, uint32_t ul_dir, uint32_t ul_maxsize, uint32_t ul_interval, uint32_t ul_nb_bank)
 Allocate a new pipe. Plus de détails...
 
void UHD_Pipe_CountZero (uint32_t ul_pipe)
 
void UHD_Pipe_Free (uint32_t ul_pipe)
 Free a pipe. Plus de détails...
 
uint32_t UHD_Pipe_Read (uint32_t pipe_num, uint32_t buf_size, uint8_t *buf)
 Read from a pipe. Plus de détails...
 
void UHD_Pipe_Write (uint32_t ul_pipe, uint32_t ul_size, uint8_t *buf)
 Write into a pipe. Plus de détails...
 
void UHD_Pipe_Send (uint32_t ul_pipe, uint32_t ul_token_type)
 Send a pipe content. Plus de détails...
 
uint32_t UHD_Pipe_Is_Transfer_Complete (uint32_t ul_pipe, uint32_t ul_token_type)
 Check for pipe transfer completion. Plus de détails...
 

Documentation des macros

◆ HOST_DEFINED

#define HOST_DEFINED

◆ NVM_USB_PAD_TRANSN_POS

#define NVM_USB_PAD_TRANSN_POS   45

◆ NVM_USB_PAD_TRANSN_SIZE

#define NVM_USB_PAD_TRANSN_SIZE   5

◆ NVM_USB_PAD_TRANSP_POS

#define NVM_USB_PAD_TRANSP_POS   50

◆ NVM_USB_PAD_TRANSP_SIZE

#define NVM_USB_PAD_TRANSP_SIZE   5

◆ NVM_USB_PAD_TRIM_POS

#define NVM_USB_PAD_TRIM_POS   55

◆ NVM_USB_PAD_TRIM_SIZE

#define NVM_USB_PAD_TRIM_SIZE   3

◆ TRACE_UOTGHS_HOST

#define TRACE_UOTGHS_HOST (   x)

Documentation des fonctions

◆ __attribute__()

__attribute__ ( (__aligned__(4))  ) volatile

Initialize the SAMD21 host driver.

◆ UHD_GetVBUSState()

uhd_vbus_state_t UHD_GetVBUSState ( void  )

Get VBUS state.

Renvoie
VBUS status.

◆ UHD_Handler()

void UHD_Handler ( void  )

Interrupt sub routine for USB Host state machine management.

◆ UHD_Pipe0_Alloc()

uint32_t UHD_Pipe0_Alloc ( uint32_t  ul_add,
uint32_t  ul_ep_size 
)

Allocate FIFO for pipe 0.

Paramètres
ul_addAddress of remote device for pipe 0.
ul_ep_sizeActual size of the FIFO in bytes.
Valeurs retournées
0success.
1error.

◆ UHD_Pipe_Alloc()

uint32_t UHD_Pipe_Alloc ( uint32_t  ul_dev_addr,
uint32_t  ul_dev_ep,
uint32_t  ul_type,
uint32_t  ul_dir,
uint32_t  ul_maxsize,
uint32_t  ul_interval,
uint32_t  ul_nb_bank 
)

Allocate a new pipe.

Note
UOTGHS maximum pipe number is limited to 10, meaning that only a limited amount of devices can be connected. Unfortunately, using only one pipe shared accross various endpoints and devices is not possible because the UOTGHS IP does not allow to change the data toggle value through register interface.
Paramètres
ul_dev_addrAddress of remote device.
ul_dev_epTargeted endpoint of remote device.
ul_typePipe type.
ul_dirPipe direction.
ul_maxsizePipe size.
ul_intervalPolling interval (if applicable to pipe type).
ul_nb_bankNumber of banks associated with this pipe.
Renvoie
1.

◆ UHD_Pipe_CountZero()

void UHD_Pipe_CountZero ( uint32_t  ul_pipe)

◆ UHD_Pipe_Free()

void UHD_Pipe_Free ( uint32_t  ul_pipe)

Free a pipe.

Paramètres
ul_pipePipe number to free.

◆ UHD_Pipe_Is_Transfer_Complete()

uint32_t UHD_Pipe_Is_Transfer_Complete ( uint32_t  ul_pipe,
uint32_t  ul_token_type 
)

Check for pipe transfer completion.

Paramètres
ul_pipePipe number.
ul_token_typeToken type.
Valeurs retournées
0transfer is not complete.
1transfer is complete.

◆ UHD_Pipe_Read()

uint32_t UHD_Pipe_Read ( uint32_t  pipe_num,
uint32_t  buf_size,
uint8_t *  buf 
)

Read from a pipe.

Paramètres
ul_pipePipe number.
ul_sizeMaximum number of data to read.
dataBuffer to store the data.
Renvoie
number of data read.

◆ UHD_Pipe_Send()

void UHD_Pipe_Send ( uint32_t  ul_pipe,
uint32_t  ul_token_type 
)

Send a pipe content.

Paramètres
ul_pipePipe number.
ul_token_typeToken type.

◆ UHD_Pipe_Write()

void UHD_Pipe_Write ( uint32_t  ul_pipe,
uint32_t  ul_size,
uint8_t *  buf 
)

Write into a pipe.

Paramètres
ul_pipePipe number.
ul_sizeMaximum number of data to read.
dataBuffer containing data to write.