# usb_drv_core

USB driver library

Author | Albert Faber, Copyright © 2008..2021, all rights reserved.
Adapted-by | Matthew Schinkel, Rob Jansen
Compiler | 2.5r5

Description

    Routines for controlling the USB serial interface engine sending
                 which will ensure the highest possible accuracy.

Sources

    http://www.usb.org for USB specifications

Dependencies

- memory_pointer1

## Summary

### Global variables/contants

### Procedures

- `usb_send_one_byte(byte in data)`
- `usb_stall_ep0()`
- `usb_prime_epx_out( byte in end_point, byte in size )`
- `usb_send_empty_data_pkt()`
- `usb_send_status_ack()`
- `usb_send_data_chunk()`
- `usb_send_data(byte in endpoint, byte in data[], byte in byte_cnt, bit in is_new_sequence )`
- `usb_configure_endpoints()`
- `usb_prime_ep0_out()`

Private

- `_usb_copy_array_to_ram(word in dst, byte in data[], byte in num_bytes )`

### Functions

## API details

### Global variables/contants

### Procedures

- `usb_send_one_byte(byte in data)`

      This procedure will send one byted via endpoint0, with the contend specified by the
      data input parameter, normally not called by the end user

- `usb_stall_ep0()`

      Set BSTALL bit and UOWN bit (SIE will own the buffer).

- `usb_prime_epx_out( byte in end_point, byte in size )`

      Initialize the given OUT endpoints with the given size.

- `usb_send_empty_data_pkt()`

      This procedure sends an empty USB packet via endpoint0, normally not called by the end user

- `usb_send_status_ack()`

      This procedure sends an USB acknowledge packet, normally not called by the end user

- `usb_send_data_chunk()`

      This procedure sends the content of the USB delivery buffer in the USB SIE
      If the MCU does not own the buffer then nothing will be sent.
      Note that this is all data for endpoint0.

- `usb_send_data(byte in endpoint, byte in data[], byte in byte_cnt, bit in is_new_sequence )`

      This procedure will send the content of an array to the USB end point. The endpoint
      input parameter contains the the enpoint number, data[] is the content to be send,
      byte_cnt the number of bytes to be send, and is_new_sequence determines if the data
      tranmission is starting with USB packet o (if set to true), otherwise the USB packet
      is toggled before transmission.
      Note: This function is not yet used by the USB driver.

- `usb_configure_endpoints()`

      This procedure will setup and initalize the USB endpoints,
      normally not called by the end user
      Endpoint0 is mandatory and was already configured by USB reset. We only configure
      endpoint 1-3 here.

- `usb_prime_ep0_out()`

      Handle an endpoint0 out request (data from Host to MCU).

Private

- `_usb_copy_array_to_ram(word in dst, byte in data[], byte in num_bytes )`

      Internal memory copy procedure
      This function copies the content from a source array towards the specified
      destination memory location. The function copies num_bytes bytes

### Functions

## Related samples

Here are the list of samples which use this library:

16f1455 | 16f1455_usb_hid_mouse.jal
16f1455 | 16f1455_usb_hid_generic.jal
18f14k50 | 18f14k50_usb_bootloader.jal
18f14k50 | 18f14k50_usb_hid_mouse.jal
18f14k50 | 18f14k50_usb_hid_generic.jal
18f14k50 | 18f14k50_usb_bootloader_autostart.jal
18f2450 | 18f2450_usb_bootloader.jal
18f2450 | 18f2450_usb_bootloader_autostart.jal
18f2450 | 18f2450_usb_hid_generic.jal
18f2450 | 18f2450_usb_hid_mouse.jal
18f2550 | 18f2550_usb_bootloader_autostart.jal
18f2550 | 18f2550_usb_hid_mouse.jal
18f2550 | 18f2550_usb_hid_generic.jal
18f4550 | 18f4550_usb_bootloader_autostart.jal
18f4550 | 18f4550_usb_hid_mouse.jal
18f4550 | 18f4550_usb_hid_generic.jal
18f4550 | 18f4550_usb_bootloader.jal
18f67j50 | 18f67j50_usb_hid_mouse.jal
18f67j50 | 18f67j50_usb_bootloader_autostart.jal
18f67j50 | 18f67j50_usb_hid_generic.jal