/* Test writing single values of various types to board's global memory. * The test passes if we read back what we wrote. */ void test_small_writes (ssize_t f) { unsigned char uc; unsigned short us; unsigned int ui; unsigned long int uli; write_uchar (f, 0, 0, 19); uc = read_uchar (f, 0, 0); assert (uc == 19); write_ushort (f, 0, 0, 13); us = read_ushort(f, 0, 0); assert (us == 13); write_ulong (f, 0, 0, 0x3037383633352030); uli = read_ulong (f, 0, 0); assert (uli == 0x3037383633352030); write_uint (f, 0, 0, 18987983); ui = read_uint (f, 0, 0); assert (ui == 18987983); printf ("test_small_writes PASSED\n"); }
void test_global_mem_write(ssize_t f) { unsigned char uc; write_uchar (f, 0, 0, 19); uc = read_uchar (f, 0, 0); if (uc != 19) { printf ("Write to global memory did not work!\n"); printf ("If the board has removable DIMMs, make sure they are inserted fully and are good\n"); } }
size_t TouchEventMessage::serialize(unsigned char *write_buffer) { size_t len = getSize(); write_uint(write_buffer, 0, &len); write_uint(write_buffer, 4, &_msg_type); write_uint(write_buffer, 8, &_client_id); write_uchar(write_buffer, 12, &_touch_event._event_type); write_float(write_buffer, 13, &_touch_event._x1); write_float(write_buffer, 17, &_touch_event._y1); write_float(write_buffer, 21, &_touch_event._x2); write_float(write_buffer, 25, &_touch_event._y2); return len; }