Wednesday, December 13th 2017, 12:09pm UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

pbs

Beginner

Date of registration: Aug 9th 2010

Posts: 3

1

Monday, August 9th 2010, 10:50pm

OS Locks

Dear Segger,



The OS interface of embFile requires me to provide an implementation of several functions for providing lock synchronization. In my setup the function FS_X_OS_Init(unsigned NumLocks) is always called with NumLocks = 0. Changing the value of FS_OS_LOCKING does not have any effect on this. Also, the comments associated with the function states that "FS_NUM_LOCKS" number of binary semaphores/mutexes should be initialized and reserved for embFile. The symbol "FS_NUM_LOCKS", however, is not known to my compiler and I have not been able to locate it in the source.



I should point out that synchronization seems to work fine but I need to "guess" the number of locks needed or allocate them as needed. Neither of those approaches is really satiafactory for our purpose.



Thank you for a very nice and easy to use product,

Peter





SEGGER - Alex

Super Moderator

Date of registration: Dec 18th 2007

Posts: 1,514

2

Tuesday, August 10th 2010, 3:57pm

Hi Peter,

the comment in the OS layer template is incorrect.
The value of NumLocks is calculated automatically.

It depends on the compile time switch FS_OS_LOCKING:

If it is not defined, NumLocks is 0
If it is defined to 0, NumLocks is 0
If it is defined to 1, NumLocks is 1
If it is defined to 2, NumLocks is 1 + number of drivers which are added in FS_X_AddDevices()

We will correct this in the template.


Best regards
Alex