Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion host_test/control_transfer_in.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ int main(int argc, char **argv)
if (libusb_init(NULL))
return -1;

handle = libusb_open_device_with_vid_pid(NULL, 0xa0a0, 0x0001);
handle = libusb_open_device_with_vid_pid(NULL, 0xa0a0, 0x0003);
if (!handle) {
perror("libusb_open failed: ");
return 1;
Expand Down
2 changes: 1 addition & 1 deletion host_test/control_transfer_out.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ int main(int argc, char **argv)
if (libusb_init(NULL))
return -1;

handle = libusb_open_device_with_vid_pid(NULL, 0xa0a0, 0x0001);
handle = libusb_open_device_with_vid_pid(NULL, 0xa0a0, 0x0003);
if (!handle) {
perror("libusb_open failed: ");
return 1;
Expand Down
2 changes: 1 addition & 1 deletion host_test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int main(int argc, char **argv)
if (libusb_init(NULL))
return -1;

handle = libusb_open_device_with_vid_pid(NULL, 0xa0a0, 0x0001);
handle = libusb_open_device_with_vid_pid(NULL, 0xa0a0, 0x0003);
if (!handle) {
perror("libusb_open failed: ");
return 1;
Expand Down
4 changes: 4 additions & 0 deletions usb/include/usb_cdc.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
#if defined(__XC16__) || defined(__XC32__)
#pragma pack(push, 1)
#elif __XC8
#if __XC8_VERSION >= 2000
// This is needed, even though the XC8 manual says its unnecessary
#pragma pack(push, 1)
#endif
#else
#error "Compiler not supported"
#endif
Expand Down
4 changes: 4 additions & 0 deletions usb/include/usb_ch9.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
#if defined(__XC16__) || defined(__XC32__)
#pragma pack(push, 1)
#elif __XC8
#if __XC8_VERSION >= 2000
// This is needed, even though the XC8 manual says its unnecessary
#pragma pack(push, 1)
#endif
#else
#error "Compiler not supported"
#endif
Expand Down
4 changes: 4 additions & 0 deletions usb/include/usb_hid.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
#if defined(__XC16__) || defined(__XC32__)
#pragma pack(push, 1)
#elif __XC8
#if __XC8_VERSION >= 2000
// This is needed, even though the XC8 manual says its unnecessary
#pragma pack(push, 1)
#endif
#else
#error "Compiler not supported"
#endif
Expand Down
4 changes: 4 additions & 0 deletions usb/include/usb_microsoft.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
#if defined(__XC16__) || defined(__XC32__)
#pragma pack(push, 1)
#elif __XC8
#if __XC8_VERSION >= 2000
// This is needed, even though the XC8 manual says its unnecessary
#pragma pack(push, 1)
#endif
#else
#error "Compiler not supported"
#endif
Expand Down
4 changes: 4 additions & 0 deletions usb/include/usb_msc.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
#if defined(__XC16__) || defined(__XC32__)
#pragma pack(push, 1)
#elif __XC8
#if __XC8_VERSION >= 2000
// This is needed, even though the XC8 manual says its unnecessary
#pragma pack(push, 1)
#endif
#else
#error "Compiler not supported"
#endif
Expand Down
25 changes: 20 additions & 5 deletions usb/src/usb_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/

#ifndef USB_HAL_H__
#define UAB_HAL_H__
#define USB_HAL_H__

#ifdef _PIC14E
#define NEEDS_PULL /* Whether to pull up D+/D- with SFR_PULL_EN. */
Expand Down Expand Up @@ -288,7 +288,14 @@ struct buffer_descriptor {
#ifdef _18F46J50
#define BD_ADDR 0x400
//#undef BUFFER_ADDR
#else
#endif

#ifdef _18F2455
#define BD_ADDR 0x400
#define BUFFER_ADDR 0x500
#endif

#ifndef BD_ADDR
#error "CPU not supported yet"
#endif

Expand All @@ -306,11 +313,19 @@ struct buffer_descriptor {
#elif defined __XC8
#define memcpy_from_rom(x,y,z) memcpy(x,y,z)
#define FAR
#define BD_ATTR_TAG @##BD_ADDR
#if __XC8_VERSION >= 2000
// XC8 discontinued the @addr notation and replaced it with __at()
#define AT_ADDR(X) __at(X)
#else
#define AT_ADDR(X) @X
#endif

#define BD_ATTR_TAG AT_ADDR(BD_ADDR)

#ifdef BUFFER_ADDR
#define XC8_BUFFER_ADDR_TAG @##BUFFER_ADDR
#define XC8_BUFFER_ADDR_TAG AT_ADDR(BUFFER_ADDR)
#else
#define XC8_BUFFER_ADDR_TAG
#define XC8_BUFFER_ADDR_TAG
#endif
#endif

Expand Down
4 changes: 2 additions & 2 deletions usb/src/usb_hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ uint8_t process_hid_setup_request(const struct setup_packet *setup)
if (len < 0)
return -1;

usb_send_data_stage((void*) desc, min(len, setup->wLength), NULL, NULL);
usb_send_data_stage((void*) desc, MIN(len, setup->wLength), NULL, NULL);
return 0;
}

Expand All @@ -112,7 +112,7 @@ uint8_t process_hid_setup_request(const struct setup_packet *setup)
if (len < 0)
return -1;

usb_send_data_stage((void*)desc, min(len, setup->wLength), callback, context);
usb_send_data_stage((void*)desc, MIN(len, setup->wLength), callback, context);
return 0;
}
#endif
Expand Down