3 回答

TA貢獻1847條經(jīng)驗 獲得超7個贊
typedef struct{ int command; int data; int isbusy;} MyHardwareGadget;
void SendCommand (MyHardwareGadget * gadget, int command, int data){ // wait while the gadget is busy: while (gadget->isbusy) { // do nothing here. } // set data first: gadget->data = data; // writing the command starts the action: gadget->command = command;}
void SendCommand (volatile MyHardwareGadget * gadget, int command, int data) { // wait while the gadget is busy: while (gadget->isbusy) { // do nothing here. } // set data first: gadget->data = data; // writing the command starts the action: gadget->command = command; }

TA貢獻1816條經(jīng)驗 獲得超6個贊
volatile
volatile
volatile

TA貢獻1848條經(jīng)驗 獲得超6個贊
volatile
volatile
volatile
- 3 回答
- 0 關(guān)注
- 660 瀏覽
添加回答
舉報