wake-0 / fhvOS

This repository contains an os for the arm cortex a8 in combination with beaglebone.
GNU General Public License v2.0
7 stars 1 forks source link

[IPC] Implement IPC #29

Closed wake-0 closed 9 years ago

wake-0 commented 9 years ago

Implement the IPC. The minimal requirement is that the console is able to use IPC to communicate with the OS, so that the OS starts processes.

trylimits commented 9 years ago

Implemented IPC in the above commits. The implementation is not tested yet. I suggest to review and test together in a coaching.

trylimits commented 9 years ago

See commit https://github.com/Blackjack92/fhvOS/commit/af300495220aad46734e0a7de6493231404fcd4f

Tested and verified working.

Small code example:

void ping(void)
{
    int res = IpcManagerRegisterNamespace("ping");

    do {
        res = IpcManagerSendMessage("ping", "pong", "PING");
    } while(res <= 0);

    printf("Ping sent...\n");

    printf("Ping is ending now...\n");
}

void pong(void)
{
    int res = IpcManagerRegisterNamespace("pong");
    while(IpcManagerHasMessage("pong") <= 0)
    {

    }
    char message[255];
    char sender[255];
    IpcManagerGetNextMessage("pong", message, 255, sender, 255);

    printf("Pong received...\n");
    printf("Message received from \"%s\": %s\n", sender, message);

    printf("Pong is ending now...\n");
}

int main(void)
{
    [...]
SchedulerStartProcess(&ConsoleProcess);
SchedulerStartProcess(&pong);
SchedulerStartProcess(&ping);
   [...]
}