This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Part Number: TMS320C6748
Tool/software: TI-RTOS
Please don't say 'never' !!!
Clearly it would be reckless to call pend() from outside a task if it is going to block, but is it OK to call it provided the count is 1 or more so it will not block? Currently, I have a program doing this and it works, but I want to be sure it's safe and I'm not just being lucky.
If you're curious why anyone would do such a bizarre thing, this is how it came about. The program uses SPI1 to access two different devices (flash memory and an ADC) from two different tasks, and needs to guarantee exclusive access to the SPI so it uses a semaphore with an initial count of 1 as a mutex. So far, so good. Then it turns out we need to read something from the flash from main, before the call to BIOS_start(); The function that reads the flash pends on a semaphore, reads flash, then posts the semaphore. So (without realising, initially) that function is called once from main, and then repeatedly later on from a task.
And it works! But should it? Needless to say, I could restructure the program if I have to, but it's a huge upheaval at this stage.
Cheers
Roy
In reply to ToddMullanix:
In reply to Roy Jackson:
Oh cool! Thanks. I didn't know about BIOS_getThreadType()
That is excellent, thanks, I can work with that.