Homework Assignment 2

 

 

Question 1: Simultaneous I/O, when being used by multiple programs simultaneously, also needs to ensure mutual exclusion. Write pseudocodes to show how mutual exclusion can be achieved for simultaenous busy-wait I/O (using busy-wait).

 

Question 2: Consider that you want to build an I/O system with 3 master devices and 4 slave devices, such that any master device should be able to communicate to any of the 4 slave devices. How this I/O system should be implemented using 1) I2C and 2) SPI I/O interface? Draw diagrams to show.

 

Question 3: Consider an embedded system with a 10MHz processor. How much time do you need to accomplish 1k times of reads and writes using 1) I2C and 2) SPI I/O interfaces? Assuming that each read/write involves 1kB of data. Note: please calculate the timing for reads and writes separately.

 

Question 4: For the following code segment, please translate it into assembly code using the ARM instruction set.

 

for(i=0; i<=10; i++) {

   if(i<5)

       num1++;

   else

       num2++;

}