File indexing completed on 2025-05-11 08:24:35
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 #ifdef HAVE_CONFIG_H
0029 #include "config.h"
0030 #endif
0031
0032 #include <bsp.h>
0033
0034 #include <stdlib.h>
0035 #include <stdio.h>
0036
0037 #include <sys/types.h>
0038 #include <sys/stat.h>
0039 #include <fcntl.h>
0040 #include <sys/ioctl.h>
0041 #include <unistd.h>
0042 #include <rtems/mw_uid.h>
0043 #include "../termios04/termios_testdriver_intr.h"
0044 #include "tmacros.h"
0045
0046 const char rtems_test_name[] = "UID 1";
0047
0048 #define UID_MESSAGE_COUNT 10
0049
0050
0051 rtems_task Init(rtems_task_argument argument);
0052 void open_it(void);
0053 void register_it(void);
0054 void printf_uid_message(struct MW_UID_MESSAGE *uid);
0055 void receive_uid_message(void);
0056 void close_it(void);
0057
0058 extern const char *Mouse_Type_Long;
0059 extern const char *Mouse_Type_Short;
0060 extern const unsigned char Mouse_Actions[];
0061 extern const size_t Mouse_Actions_Size;
0062 extern const size_t Mouse_Actions_Per_Iteration;
0063
0064 int Mouse_Index = 0;
0065
0066 int Test_fd;
0067
0068 void open_it(void)
0069 {
0070
0071 Test_fd = open( "/dev/mouse", O_RDONLY );
0072 rtems_test_assert( Test_fd != -1 );
0073 }
0074
0075 void register_it(void)
0076 {
0077 int rc;
0078 char name[5] = "mous";
0079
0080 rc = uid_open_queue( name, 0, UID_MESSAGE_COUNT );
0081 rtems_test_assert( rc == 0 );
0082
0083 rc = uid_register_device( Test_fd, name );
0084 rtems_test_assert( rc == 0 );
0085 }
0086
0087 void printf_uid_message(
0088 struct MW_UID_MESSAGE *uid
0089 )
0090 {
0091 uid_print_message_with_plugin(
0092 &rtems_test_printer,
0093 uid
0094 );
0095 }
0096
0097 void receive_uid_message(void)
0098 {
0099 int rc;
0100 struct MW_UID_MESSAGE uid;
0101
0102 rc = uid_read_message( &uid, 0.5L );
0103 if ( rc != sizeof(struct MW_UID_MESSAGE) )
0104 return;
0105 printf_uid_message( &uid );
0106 }
0107
0108 void close_it(void)
0109 {
0110 int rc;
0111
0112 rc = uid_unregister_device( Test_fd );
0113 rtems_test_assert( rc == 0 );
0114
0115 rc = close( Test_fd );
0116 rtems_test_assert( rc == 0 );
0117 }
0118
0119 rtems_task Init(
0120 rtems_task_argument ignored
0121 )
0122 {
0123
0124 TEST_BEGIN();
0125
0126 open_it();
0127 register_it();
0128
0129
0130
0131
0132
0133
0134
0135 receive_uid_message();
0136
0137 close_it();
0138 TEST_END();
0139 rtems_test_exit( 0 );
0140 }
0141
0142
0143
0144 #include <rtems/serial_mouse.h>
0145
0146
0147 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
0148 #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
0149 #define CONFIGURE_APPLICATION_EXTRA_DRIVERS \
0150 TERMIOS_TEST_DRIVER_TABLE_ENTRY, \
0151 SERIAL_MOUSE_DRIVER_TABLE_ENTRY
0152
0153
0154 #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 5
0155 #define CONFIGURE_MAXIMUM_TASKS 1
0156 #define CONFIGURE_MAXIMUM_TIMERS 2
0157 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
0158
0159 #define CONFIGURE_MESSAGE_BUFFER_MEMORY \
0160 CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( \
0161 UID_MESSAGE_COUNT, \
0162 sizeof(struct MW_UID_MESSAGE) \
0163 )
0164
0165 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
0166
0167 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
0168
0169 #define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
0170
0171 #define CONFIGURE_INIT
0172
0173 #include <rtems/confdefs.h>
0174
0175