Advertisement
Guest User

lab9

a guest
Dec 11th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. void task8(void* pdata){
  2.  
  3. volatile int * PS2_ptr = (int *)PS2_0_BASE;
  4. int PS2_data, RVALID;
  5. char byte = 0;
  6.  
  7. *(PS2_ptr) = 0xFF;
  8.  
  9. while(1){
  10. PS2_data = *(PS2_ptr); // read the Data register in the PS/2 port
  11. RVALID = PS2_data & 0x8000; // extract the RVALID field
  12. if (RVALID) {
  13. /* shift the next data byte into the display */
  14. byte = PS2_data & 0xFF;
  15. *znak=byte;
  16.  
  17. printf("%d\n",byte);
  18.  
  19. /*if ((byte2 == (char)0xAA) && (byte3 == (char)0x00))
  20. // mouse inserted; initialize sending of data
  21. *(PS2_ptr) = 0xF4;*/
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement