readdevice

Description:

Read bytes from a device specified by its s_device-struct. This function does not check any access-conflicts with other tasks thus it must not be called from user-space. User program-code may access devices through device-files over the open-function.

Function Prototype:

unsigned long k_readdevice (struct s_device * device, unsigned char * buffer, unsigned long buffersize, unsigned long offset);

Parameters:

device

A pointer to a struct of type s_device which represents the device to be accessed in memory. This struct is retrieved when opening a device with the getdevice-function.

buffer

A pointer to a buffer in memory where data should be read to.

buffersize

The size in bytes of the buffer.

offset

The offset of a blockdevice where the read-operation should start. (This parameter is ignored by character-devices).

Return Values:

Returns the count of bytes read from the device.


See also getdevice, writedevice