type
stringclasses
5 values
content
stringlengths
9
163k
functions
uint8_t USBD_CUSTOM_HID_SendReport (USBD_HandleTypeDef *pdev, uint8_t *report, uint16_t len) { USBD_CUSTOM_HID_HandleTypeDef *hhid = (USBD_CUSTOM_HID_HandleTypeDef*)pdev->pClassData; if (pdev->dev_state == USBD_STATE_CONFIGURED ) { ...
functions
uint8_t USBD_CUSTOM_HID_DataIn (USBD_HandleTypeDef *pdev, uint8_t epnum) { /* Ensure that the FIFO is empty before a new transfer, this condition could be caused by a new transfer before the end of the previous transfer */ ((USBD_CUSTOM_HID_HandleTypeDef *)pdev->pClassData)->s...
functions
uint8_t USBD_CUSTOM_HID_DataOut (USBD_HandleTypeDef *pdev, uint8_t epnum) { USBD_CUSTOM_HID_HandleTypeDef *hhid = (USBD_CUSTOM_HID_HandleTypeDef*)pdev->pClassData; ((USBD_CUSTOM_HID_ItfTypeDef *)pdev->pUserData)->OutEvent(hhid->Report_buf[0], ...
functions
uint8_t USBD_CUSTOM_HID_EP0_RxReady(USBD_HandleTypeDef *pdev) { USBD_CUSTOM_HID_HandleTypeDef *hhid = (USBD_CUSTOM_HID_HandleTypeDef*)pdev->pClassData; if (hhid->IsReportAvailable == 1) { ((USBD_CUSTOM_HID_ItfTypeDef *)pdev->pUserData)->OutEvent(hhid->Report_buf[0], ...
functions
uint8_t USBD_CUSTOM_HID_RegisterInterface (USBD_HandleTypeDef *pdev, USBD_CUSTOM_HID_ItfTypeDef *fops) { uint8_t ret = USBD_FAIL; if(fops != NULL) { pdev->pUserData= fops; ret = USBD_OK; }
includes
#include <stdlib.h>
includes
#include <stdint.h>
includes
#include <stdio.h>
includes
#include <string.h>
structs
struct input_panel_surface { struct wl_resource *resource; struct wl_signal destroy_signal; struct ivi_shell *shell; struct wl_list link; struct weston_surface *surface; struct weston_view *view; struct wl_listener surface_destroy_listener; struct weston_view_animation *anim; struct weston_output *output; ...
functions
void input_panel_slide_done(struct weston_view_animation *animation, void *data) { struct input_panel_surface *ipsurf = data; ipsurf->anim = NULL; }
functions
void show_input_panel_surface(struct input_panel_surface *ipsurf) { struct ivi_shell *shell = ipsurf->shell; struct weston_seat *seat; struct weston_surface *focus; float x, y; wl_list_for_each(seat, &shell->compositor->seat_list, link) { struct weston_keyboard *keyboard = weston_seat_get_keyboard(seat); ...
functions
void show_input_panels(struct wl_listener *listener, void *data) { struct ivi_shell *shell = container_of(listener, struct ivi_shell, show_input_panel_listener); struct input_panel_surface *ipsurf, *next; shell->text_input.surface = (struct weston_surface*)data; if (shell->showing_input_panels) return...
functions
void hide_input_panels(struct wl_listener *listener, void *data) { struct ivi_shell *shell = container_of(listener, struct ivi_shell, hide_input_panel_listener); struct weston_view *view, *next; if (!shell->showing_input_panels) return; shell->showing_input_panels = false; if (!shell->locked) wl_l...
functions
void update_input_panels(struct wl_listener *listener, void *data) { struct ivi_shell *shell = container_of(listener, struct ivi_shell, update_input_panel_listener); memcpy(&shell->text_input.cursor_rectangle, data, sizeof(pixman_box32_t)); }
functions
int input_panel_get_label(struct weston_surface *surface, char *buf, size_t len) { return snprintf(buf, len, "input panel"); }
functions
void input_panel_committed(struct weston_surface *surface, int32_t sx, int32_t sy) { struct input_panel_surface *ip_surface = surface->committed_private; struct ivi_shell *shell = ip_surface->shell; struct weston_view *view; float x, y; if (surface->width == 0) return; if (ip_surface->panel) { view = get_de...
functions
void destroy_input_panel_surface(struct input_panel_surface *input_panel_surface) { wl_signal_emit(&input_panel_surface->destroy_signal, input_panel_surface); wl_list_remove(&input_panel_surface->surface_destroy_listener.link); wl_list_remove(&input_panel_surface->link); input_panel_surface->surface->committed = ...
functions
void input_panel_handle_surface_destroy(struct wl_listener *listener, void *data) { struct input_panel_surface *ipsurface = container_of(listener, struct input_panel_surface, surface_destroy_listener); if (ipsurface->resource) { wl_resource_destroy(ipsurface->resource); }
functions
void input_panel_surface_set_toplevel(struct wl_client *client, struct wl_resource *resource, struct wl_resource *output_resource, uint32_t position) { struct input_panel_surface *input_panel_surface = wl_resource_get_user_data(resource); struct ivi_shell *shell = input_panel_surface->shell; wl_lis...
functions
void input_panel_surface_set_overlay_panel(struct wl_client *client, struct wl_resource *resource) { struct input_panel_surface *input_panel_surface = wl_resource_get_user_data(resource); struct ivi_shell *shell = input_panel_surface->shell; wl_list_insert(&shell->input_panel.surfaces, &input_p...
functions
void destroy_input_panel_surface_resource(struct wl_resource *resource) { struct input_panel_surface *ipsurf = wl_resource_get_user_data(resource); destroy_input_panel_surface(ipsurf); }
functions
void input_panel_get_input_panel_surface(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *surface_resource) { struct weston_surface *surface = wl_resource_get_user_data(surface_resource); struct ivi_shell *shell = wl_resource_get_user_data(resource); ...
functions
void unbind_input_panel(struct wl_resource *resource) { struct ivi_shell *shell = wl_resource_get_user_data(resource); shell->input_panel.binding = NULL; }
functions
void bind_input_panel(struct wl_client *client, void *data, uint32_t version, uint32_t id) { struct ivi_shell *shell = data; struct wl_resource *resource; resource = wl_resource_create(client, &zwp_input_panel_v1_interface, 1, id); if (shell->input_panel.binding == NULL) { wl_resource_set...
functions
void input_panel_destroy(struct ivi_shell *shell) { wl_list_remove(&shell->show_input_panel_listener.link); wl_list_remove(&shell->hide_input_panel_listener.link); }
functions
int input_panel_setup(struct ivi_shell *shell) { struct weston_compositor *ec = shell->compositor; shell->show_input_panel_listener.notify = show_input_panels; wl_signal_add(&ec->show_input_panel_signal, &shell->show_input_panel_listener); shell->hide_input_panel_listener.notify = hide_input_panels; wl_si...
includes
#include <arch/x64/init.h>
defines
#define __NAUTILUS_MAIN__
functions
void main (unsigned long mbd, unsigned long magic) { init(mbd, magic); }
functions
cJSON_bool compare_from_string(const char * const a, const char * const b, const cJSON_bool case_sensitive) { cJSON *a_json = NULL; cJSON *b_json = NULL; cJSON_bool result = false; a_json = cJSON_Parse(a); TEST_ASSERT_NOT_NULL_MESSAGE(a_json, "Failed to parse a."); b_json = cJSON_Parse(b); ...
functions
void cjson_compare_should_compare_null_pointer_as_not_equal(void) { TEST_ASSERT_FALSE(cJSON_Compare(NULL, NULL, true)); TEST_ASSERT_FALSE(cJSON_Compare(NULL, NULL, false)); }
functions
void cjson_compare_should_compare_invalid_as_not_equal(void) { cJSON invalid[1]; memset(invalid, '\0', sizeof(invalid)); TEST_ASSERT_FALSE(cJSON_Compare(invalid, invalid, false)); TEST_ASSERT_FALSE(cJSON_Compare(invalid, invalid, true)); }
functions
void cjson_compare_should_compare_numbers(void) { TEST_ASSERT_TRUE(compare_from_string("1", "1", true)); TEST_ASSERT_TRUE(compare_from_string("1", "1", false)); TEST_ASSERT_TRUE(compare_from_string("0.0001", "0.0001", true)); TEST_ASSERT_TRUE(compare_from_string("0.0001", "0.0001", false)); TEST_AS...
functions
void cjson_compare_should_compare_booleans(void) { /* true */ TEST_ASSERT_TRUE(compare_from_string("true", "true", true)); TEST_ASSERT_TRUE(compare_from_string("true", "true", false)); /* false */ TEST_ASSERT_TRUE(compare_from_string("false", "false", true)); TEST_ASSERT_TRUE(compare_from_strin...
functions
void cjson_compare_should_compare_null(void) { TEST_ASSERT_TRUE(compare_from_string("null", "null", true)); TEST_ASSERT_TRUE(compare_from_string("null", "null", false)); TEST_ASSERT_FALSE(compare_from_string("null", "true", true)); TEST_ASSERT_FALSE(compare_from_string("null", "true", false)); }
functions
void cjson_compare_should_not_accept_invalid_types(void) { cJSON invalid[1]; memset(invalid, '\0', sizeof(invalid)); invalid->type = cJSON_Number | cJSON_String; TEST_ASSERT_FALSE(cJSON_Compare(invalid, invalid, true)); TEST_ASSERT_FALSE(cJSON_Compare(invalid, invalid, false)); }
functions
void cjson_compare_should_compare_strings(void) { TEST_ASSERT_TRUE(compare_from_string("\"abcdefg\"", "\"abcdefg\"", true)); TEST_ASSERT_TRUE(compare_from_string("\"abcdefg\"", "\"abcdefg\"", false)); TEST_ASSERT_FALSE(compare_from_string("\"ABCDEFG\"", "\"abcdefg\"", true)); TEST_ASSERT_FALSE(compare_...
functions
void cjson_compare_should_compare_raw(void) { cJSON *raw1 = NULL; cJSON *raw2 = NULL; raw1 = cJSON_Parse("\"[true, false]\""); TEST_ASSERT_NOT_NULL(raw1); raw2 = cJSON_Parse("\"[true, false]\""); TEST_ASSERT_NOT_NULL(raw2); raw1->type = cJSON_Raw; raw2->type = cJSON_Raw; TEST_ASSE...
functions
void cjson_compare_should_compare_arrays(void) { TEST_ASSERT_TRUE(compare_from_string("[]", "[]", true)); TEST_ASSERT_TRUE(compare_from_string("[]", "[]", false)); TEST_ASSERT_TRUE(compare_from_string("[false,true,null,42,\"string\",[],{}
functions
void cjson_compare_should_compare_objects(void) { TEST_ASSERT_TRUE(compare_from_string("{}
main
int main(void) { UNITY_BEGIN(); RUN_TEST(cjson_compare_should_compare_null_pointer_as_not_equal); RUN_TEST(cjson_compare_should_compare_invalid_as_not_equal); RUN_TEST(cjson_compare_should_compare_numbers); RUN_TEST(cjson_compare_should_compare_booleans); RUN_TEST(cjson_compare_should_compare_n...
includes
#include <stdbool.h>
includes
#include <stddef.h>
includes
#include <stdio.h>
includes
#include <stdlib.h>
includes
#include <string.h>
includes
#include <getopt.h>
includes
#include <xtables.h>
functions
void condition_help(void) { printf( "condition match options:\n" "[!] --condition name Match on boolean value stored in procfs file\n" ); }
functions
int condition_parse(int c, char **argv, int invert, unsigned int *flags, const void *entry, struct xt_entry_match **match) { struct xt_condition_mtinfo *info = (void *)(*match)->data; if (c == 'X') { if (*flags) xtables_error(PARAMETER_PROBLEM, "Can't specify multiple condition...
functions
void condition_check(unsigned int flags) { if (flags == 0) xtables_error(PARAMETER_PROBLEM, "Condition match: must specify --condition"); }
functions
void condition_print(const void *ip, const struct xt_entry_match *match, int numeric) { const struct xt_condition_mtinfo *info = (const void *)match->data; printf(" condition %s%s ", (info->invert) ? "!" : "", info->name); }
functions
void condition_save(const void *ip, const struct xt_entry_match *match) { const struct xt_condition_mtinfo *info = (const void *)match->data; printf("%s --condition \"%s\" ", info->invert ? " !" : "", info->name); }
functions
void condition_mt_ldr(void) { xtables_register_match(&condition_mt_reg); }
includes
#include <stdio.h>
includes
#include <stdlib.h>
includes
#include <stdint.h>
includes
#include <fcntl.h>
includes
#include <errno.h>
includes
#include <stdbool.h>
includes
#include <sys/ioctl.h>
includes
#include <linux/i2c-dev.h>
functions
int8_t mcp23017WriteByte( struct mcp23017 *mcp23017, uint8_t reg, uint8_t data ) { // Should work with IOCON.BANK = 0 or IOCON.BANK = 1 for PORT A and B. uint8_t handle = mcp23017->id; uint8_t bank = mcp23017->bank; // Get register address for BANK mode. uint8_t addr = mcp2...
functions
int8_t mcp23017ReadByte( struct mcp23017 *mcp23017, uint8_t reg ) { // Should work with IOCON.BANK = 0 or IOCON.BANK = 1 for PORT A and B. uint8_t handle = mcp23017->id; uint8_t bank = mcp23017->bank; // Get register address for BANK mode. uint8_t addr = mcp23017Register[reg][bank]; // Return re...
functions
int16_t mcp23017ReadWord( struct mcp23017 *mcp23017, uint8_t reg ) { /* Currently undefined if IOCON.BANK = 1 and PORT = B. Need to be able to check PORT - lookup table? */ uint8_t handle = mcp23017->id; uint8_t bank = mcp23017->bank; // Get register address for BANK mode. uint8_t addr = mcp2301...
functions
bool mcp23017CheckBitsByte( struct mcp23017 *mcp23017, uint8_t reg, uint8_t data ) { // Should work with IOCON.BANK = 0 or IOCON.BANK = 1 for PORT A and B. uint8_t handle = mcp23017->id; uint8_t bank = mcp23017->bank; // Get register address for BANK mode. uint8_t addr = ...
functions
int8_t mcp23017ToggleBitsByte( struct mcp23017 *mcp23017, uint8_t reg, uint8_t data ) { // Should work with IOCON.BANK = 0 or IOCON.BANK = 1 for PORT A and B uint8_t handle = mcp23017->id; uint8_t bank = mcp23017->bank; // Get register address for BANK mode. uint8_t ad...
functions
int8_t mcp23017SetBitsByte( struct mcp23017 *mcp23017, uint8_t reg, uint8_t data ) { // Should work with IOCON.BANK = 0 or IOCON.BANK = 1 for PORT A and B uint8_t handle = mcp23017->id; uint8_t bank = mcp23017->bank; // Get register address for BANK mode. uint8_t addr = m...
functions
int8_t mcp23017ClearBitsByte( struct mcp23017 *mcp23017, uint8_t reg, uint8_t data ) { // Should work with IOCON.BANK = 0 or IOCON.BANK = 1 for PORT A and B. uint8_t handle = mcp23017->id; uint8_t bank = mcp23017->bank; // Get register address for BANK mode. uint8_t add...
functions
int8_t mcp23017Init( uint8_t addr ) { struct mcp23017 *mcp23017this; // MCP23017 instance. static bool init = false; // 1st call. static uint8_t index = 0; int8_t id = -1; uint8_t i; // Set all intances of mcp23017 to NULL on first call. if ( !init ) for ( i = 0; i < MCP230...
includes
#include <linux/init.h>
includes
#include <linux/spinlock.h>
includes
#include <linux/slab.h>
includes
#include <linux/hash.h>
structs
struct wa_seg { struct urb urb; struct urb *dto_urb; /* for data output? */ struct list_head list_node; /* for rpipe->req_list */ struct wa_xfer *xfer; /* out xfer */ u8 index; /* which segment we are */ enum wa_seg_status status; ssize_t result; /* bytes xfered or error */ struct wa_xfer_hdr xfer_hdr; u...
structs
struct wa_xfer { struct kref refcnt; struct list_head list_node; spinlock_t lock; u32 id; struct wahc *wa; /* Wire adapter we are plugged to */ struct usb_host_endpoint *ep; struct urb *urb; /* URB we are transferring for */ struct wa_seg **seg; /* transfer segments */ u8 segs, segs_submitted, segs_done; ...
structs
struct wa_xfer_abort_buffer { struct urb urb; struct wa_xfer_abort cmd; };
functions
void wa_seg_init(struct wa_seg *seg) { /* usb_init_urb() repeats a lot of work, so we do it here */ kref_init(&seg->urb.kref); }
functions
void wa_xfer_init(struct wa_xfer *xfer) { kref_init(&xfer->refcnt); INIT_LIST_HEAD(&xfer->list_node); spin_lock_init(&xfer->lock); }
functions
void wa_xfer_destroy(struct kref *_xfer) { struct wa_xfer *xfer = container_of(_xfer, struct wa_xfer, refcnt); if (xfer->seg) { unsigned cnt; for (cnt = 0; cnt < xfer->segs; cnt++) { if (xfer->is_inbound) usb_put_urb(xfer->seg[cnt]->dto_urb); usb_put_urb(&xfer->seg[cnt]->urb); }
functions
void wa_xfer_get(struct wa_xfer *xfer) { kref_get(&xfer->refcnt); }
functions
void wa_xfer_put(struct wa_xfer *xfer) { kref_put(&xfer->refcnt, wa_xfer_destroy); }
functions
void wa_xfer_giveback(struct wa_xfer *xfer) { unsigned long flags; spin_lock_irqsave(&xfer->wa->xfer_list_lock, flags); list_del_init(&xfer->list_node); spin_unlock_irqrestore(&xfer->wa->xfer_list_lock, flags); /* FIXME: segmentation broken -- kills DWA */ wusbhc_giveback_urb(xfer->wa->wusb, xfer->urb, xfer->res...
functions
void wa_xfer_completion(struct wa_xfer *xfer) { if (xfer->wusb_dev) wusb_dev_put(xfer->wusb_dev); rpipe_put(xfer->ep->hcpriv); wa_xfer_giveback(xfer); }
functions
unsigned __wa_xfer_is_done(struct wa_xfer *xfer) { struct device *dev = &xfer->wa->usb_iface->dev; unsigned result, cnt; struct wa_seg *seg; struct urb *urb = xfer->urb; unsigned found_short = 0; result = xfer->segs_done == xfer->segs_submitted; if (result == 0) goto out; urb->actual_length = 0; for (cnt = ...
functions
void wa_xfer_id_init(struct wa_xfer *xfer) { xfer->id = atomic_add_return_unchecked(1, &xfer->wa->xfer_id_count); }
functions
u32 wa_xfer_id(struct wa_xfer *xfer) { return xfer->id; }
functions
void __wa_xfer_abort_cb(struct urb *urb) { struct wa_xfer_abort_buffer *b = urb->context; usb_put_urb(&b->urb); }
functions
void __wa_xfer_abort(struct wa_xfer *xfer) { int result; struct device *dev = &xfer->wa->usb_iface->dev; struct wa_xfer_abort_buffer *b; struct wa_rpipe *rpipe = xfer->ep->hcpriv; b = kmalloc(sizeof(*b), GFP_ATOMIC); if (b == NULL) goto error_kmalloc; b->cmd.bLength = sizeof(b->cmd); b->cmd.bRequestType = W...
functions
ssize_t __wa_xfer_setup_sizes(struct wa_xfer *xfer, enum wa_xfer_type *pxfer_type) { ssize_t result; struct device *dev = &xfer->wa->usb_iface->dev; size_t maxpktsize; struct urb *urb = xfer->urb; struct wa_rpipe *rpipe = xfer->ep->hcpriv; switch (rpipe->descr.bmAttribute & 0x3) { case USB_ENDPOINT_XFE...
functions
void __wa_xfer_setup_hdr0(struct wa_xfer *xfer, struct wa_xfer_hdr *xfer_hdr0, enum wa_xfer_type xfer_type, size_t xfer_hdr_size) { struct wa_rpipe *rpipe = xfer->ep->hcpriv; xfer_hdr0 = &xfer->seg[0]->xfer_hdr; xfer_hdr0->bLength = xfer_hdr_size; xfer_hdr0->bRequestType = xfer_type; xfer_hdr0->wRP...
functions
void wa_seg_dto_cb(struct urb *urb) { struct wa_seg *seg = urb->context; struct wa_xfer *xfer = seg->xfer; struct wahc *wa; struct device *dev; struct wa_rpipe *rpipe; unsigned long flags; unsigned rpipe_ready = 0; u8 done = 0; switch (urb->status) { case 0: spin_lock_irqsave(&xfer->lock, flags); wa = xf...
functions
void wa_seg_cb(struct urb *urb) { struct wa_seg *seg = urb->context; struct wa_xfer *xfer = seg->xfer; struct wahc *wa; struct device *dev; struct wa_rpipe *rpipe; unsigned long flags; unsigned rpipe_ready; u8 done = 0; switch (urb->status) { case 0: spin_lock_irqsave(&xfer->lock, flags); wa = xfer->wa; ...
functions
int __wa_xfer_setup_segs(struct wa_xfer *xfer, size_t xfer_hdr_size) { int result, cnt; size_t alloc_size = sizeof(*xfer->seg[0]) - sizeof(xfer->seg[0]->xfer_hdr) + xfer_hdr_size; struct usb_device *usb_dev = xfer->wa->usb_dev; const struct usb_endpoint_descriptor *dto_epd = xfer->wa->dto_epd; struct wa_seg *seg...
functions
int __wa_xfer_setup(struct wa_xfer *xfer, struct urb *urb) { int result; struct device *dev = &xfer->wa->usb_iface->dev; enum wa_xfer_type xfer_type = 0; /* shut up GCC */ size_t xfer_hdr_size, cnt, transfer_size; struct wa_xfer_hdr *xfer_hdr0, *xfer_hdr; result = __wa_xfer_setup_sizes(xfer, &xfer_type); if (re...
functions
int __wa_seg_submit(struct wa_rpipe *rpipe, struct wa_xfer *xfer, struct wa_seg *seg) { int result; result = usb_submit_urb(&seg->urb, GFP_ATOMIC); if (result < 0) { printk(KERN_ERR "xfer %p#%u: REQ submit failed: %d\n", xfer, seg->index, result); goto error_seg_submit; }
functions
void wa_xfer_delayed_run(struct wa_rpipe *rpipe) { int result; struct device *dev = &rpipe->wa->usb_iface->dev; struct wa_seg *seg; struct wa_xfer *xfer; unsigned long flags; spin_lock_irqsave(&rpipe->seg_lock, flags); while (atomic_read(&rpipe->segs_available) > 0 && !list_empty(&rpipe->seg_list)) { s...
functions
int __wa_xfer_submit(struct wa_xfer *xfer) { int result; struct wahc *wa = xfer->wa; struct device *dev = &wa->usb_iface->dev; unsigned cnt; struct wa_seg *seg; unsigned long flags; struct wa_rpipe *rpipe = xfer->ep->hcpriv; size_t maxrequests = le16_to_cpu(rpipe->descr.wRequests); u8 available; u8 empty; s...
functions
void wa_urb_enqueue_b(struct wa_xfer *xfer) { int result; unsigned long flags; struct urb *urb = xfer->urb; struct wahc *wa = xfer->wa; struct wusbhc *wusbhc = wa->wusb; struct wusb_dev *wusb_dev; unsigned done; result = rpipe_get_by_ep(wa, xfer->ep, urb, xfer->gfp); if (result < 0) goto error_rpipe_get; r...