Simulation Infrastructure
Create a thread called operation_listener
. It will be very similar to the thread prv_rx_thread
in x86/can_hw.c
Will essentially take in a “request” and immediate does operations on it.
<OPERATION>: LEN, PARAM1, PARAM2, PARAM3
ID | Operation | PARAM1 | PARAM2 | PARAM3 |
---|---|---|---|---|
0 | GPIO_SET | GPIO PORT | GPIO PIN | STATE |
1 | GPIO_TOGGLE | GPIO PORT | GPIO PIN |
|
2 | GPIO_IT_TRIGGER | GPIO PORT | GPIO PIN |
|
3 | ADC_SET_READING | GPIO PORT | GPIO PIN | READING |
4 | I2C_SET_READING | I2C PORT | I2C LEN | I2C DATA |
5 | SPI_SET_RX | SPI DATA | SPI LEN |
|
6 | UART??? |
|
|
|
To create the task, create function called sim_init(int socket_num)
Main functions will need to be changed into this for simulation:
#ifdef x86
int main(int argc, char *argv[]) {
sim_init(argv[0]); // Need to cast this into an int for socket number
#else
int main() {
#endif