Trying to get data from ADC-HX711 through GPIO9_12(60)(SCK) and GPIO9_15(48)(Dout)

Hello Everyone,
I am newbie in embedded Linux stuff. I am doing a task to interface one 24-bit ADC name HX711. Which uses custom protocol. Where it uses two pins. In which One pin used as clock and 2nd one is used as Data out line.

For this purpose I am using GPIO9_12(SCK) and GPIO9_15(Dout) of BeagleBone Black rev C.

I have set the direction of these 2 pins after going under /sys/class/gpio/gpioxx/direction as OUT and IN as per requirements.
But I am not able to get data from HX711. So I debug and Find out that I am taking one time than required. Typically my SCK pin must remain high1-2 mico Seconds but I am taking 5-6 mico Seconds. Which is not desirable. All this Code is in C language.

Now I need Your suggestions that How can I speed up my GPIO pin reading and Writing Time.

I have seen some example where writers trying to Show the GPIO configuration. using mmap(). But no one talking about the GPIO speed.

Thanks

I have set the direction of these 2 pins after going under
/sys/class/gpio/gpioxx/direction as OUT and IN as per requirements.
But I am not able to get data from HX711. So I debug and Find out that I am
taking one time than required. Typically my SCK pin must remain high1-2
mico Seconds but I am taking 5-6 mico Seconds. Which is not desirable. *All
this Code is in C language.*

  The first thing to understand is that the BBB is not a microcontroller
with deterministic timing (the PRU modules, however, ARE microcontrollers).
The documentation for that chip assumes a microcontroller.

  You are going through the LINUX file system to access kernel modules
for GPIO. LINUX is not real-time. Essentually, each time you issue a set
(write) or read of a GPIO, your process is suspended, while the OS
schedules your I/O. If there are other processes suspended, of equal
priority, one of them may be woken up next.

  The actual read-back of a sample is close to the SPI protocol, but the
odd timings needed for configuring the chip are not...

Now I need Your suggestions that How can I speed up my GPIO pin reading and
Writing Time.

  Avoid the sysfs calls if possible (you don't show your code so it is
difficult to make suggestions). Write a driver using the PRU, and an
interface to the application running on Linux (remoteproc/rpmsg).

I have seen some example where writers trying to Show the GPIO
configuration. using mmap(). But no one talking about the GPIO speed.

  mmap() is bypassing the sysfs kernel calls by running as a privileged
process with direct access to the processor registers controlling GPIO.

Thanks Dennis …!!!

1 ) Yes, I am avoiding to use < sysfs >. Now I am not using it for my purpose.
2 ) Now I have written program using mmap() where I am maintaining necessary time delay which is required by HX711 sensor given into Datasheet.
I am also attaching that program to analyze.

Github Link