Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions
smscoreapi.c File Reference
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/dma-mapping.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/slab.h>
#include <linux/firmware.h>
#include <linux/wait.h>
#include <asm/byteorder.h>
#include "smscoreapi.h"
#include "sms-cards.h"
#include "smsir.h"
#include "smsendian.h"

Go to the source code of this file.

Data Structures

struct  smscore_device_notifyee_t
 
struct  smscore_idlist_t
 
struct  smscore_client_t
 
struct  smscore_registry_entry_t
 

Functions

 module_param_named (debug, sms_dbg, int, 0644)
 
 MODULE_PARM_DESC (debug,"set debug level (info=1, adv=2 (or-able))")
 
void smscore_set_board_id (struct smscore_device_t *core, int id)
 
int smscore_led_state (struct smscore_device_t *core, int led)
 
 EXPORT_SYMBOL_GPL (smscore_set_board_id)
 
int smscore_get_board_id (struct smscore_device_t *core)
 
 EXPORT_SYMBOL_GPL (smscore_get_board_id)
 
 module_param (default_mode, int, 0644)
 
 MODULE_PARM_DESC (default_mode,"default firmware id (device mode)")
 
int smscore_registry_getmode (char *devpath)
 
 EXPORT_SYMBOL_GPL (smscore_registry_getmode)
 
void smscore_registry_setmode (char *devpath, int mode)
 
int smscore_register_hotplug (hotplug_t hotplug)
 
 EXPORT_SYMBOL_GPL (smscore_register_hotplug)
 
void smscore_unregister_hotplug (hotplug_t hotplug)
 
 EXPORT_SYMBOL_GPL (smscore_unregister_hotplug)
 
int smscore_register_device (struct smsdevice_params_t *params, struct smscore_device_t **coredev)
 
 EXPORT_SYMBOL_GPL (smscore_register_device)
 
int smscore_start_device (struct smscore_device_t *coredev)
 
 EXPORT_SYMBOL_GPL (smscore_start_device)
 
void smscore_unregister_device (struct smscore_device_t *coredev)
 
 EXPORT_SYMBOL_GPL (smscore_unregister_device)
 
int smscore_set_device_mode (struct smscore_device_t *coredev, int mode)
 
int smscore_get_device_mode (struct smscore_device_t *coredev)
 
 EXPORT_SYMBOL_GPL (smscore_get_device_mode)
 
void smscore_onresponse (struct smscore_device_t *coredev, struct smscore_buffer_t *cb)
 
 EXPORT_SYMBOL_GPL (smscore_onresponse)
 
struct smscore_buffer_tget_entry (struct smscore_device_t *coredev)
 
struct smscore_buffer_tsmscore_getbuffer (struct smscore_device_t *coredev)
 
 EXPORT_SYMBOL_GPL (smscore_getbuffer)
 
void smscore_putbuffer (struct smscore_device_t *coredev, struct smscore_buffer_t *cb)
 
 EXPORT_SYMBOL_GPL (smscore_putbuffer)
 
int smscore_register_client (struct smscore_device_t *coredev, struct smsclient_params_t *params, struct smscore_client_t **client)
 
 EXPORT_SYMBOL_GPL (smscore_register_client)
 
void smscore_unregister_client (struct smscore_client_t *client)
 
 EXPORT_SYMBOL_GPL (smscore_unregister_client)
 
int smsclient_sendrequest (struct smscore_client_t *client, void *buffer, size_t size)
 
 EXPORT_SYMBOL_GPL (smsclient_sendrequest)
 
int smscore_configure_gpio (struct smscore_device_t *coredev, u32 pin, struct smscore_config_gpio *pinconfig)
 
int smscore_set_gpio (struct smscore_device_t *coredev, u32 pin, int level)
 
int smscore_gpio_configure (struct smscore_device_t *coredev, u8 PinNum, struct smscore_gpio_config *pGpioConfig)
 
int smscore_gpio_set_level (struct smscore_device_t *coredev, u8 PinNum, u8 NewLevel)
 
int smscore_gpio_get_level (struct smscore_device_t *coredev, u8 PinNum, u8 *level)
 
 module_init (smscore_module_init)
 
 module_exit (smscore_module_exit)
 
 MODULE_DESCRIPTION ("Siano MDTV Core module")
 
 MODULE_AUTHOR ("Siano Mobile Silicon, Inc. ([email protected])")
 
 MODULE_LICENSE ("GPL")
 

Function Documentation

EXPORT_SYMBOL_GPL ( smscore_set_board_id  )
EXPORT_SYMBOL_GPL ( smscore_get_board_id  )
EXPORT_SYMBOL_GPL ( smscore_registry_getmode  )
EXPORT_SYMBOL_GPL ( smscore_register_hotplug  )
EXPORT_SYMBOL_GPL ( smscore_unregister_hotplug  )
EXPORT_SYMBOL_GPL ( smscore_register_device  )
EXPORT_SYMBOL_GPL ( smscore_start_device  )
EXPORT_SYMBOL_GPL ( smscore_unregister_device  )
EXPORT_SYMBOL_GPL ( smscore_get_device_mode  )
EXPORT_SYMBOL_GPL ( smscore_onresponse  )
EXPORT_SYMBOL_GPL ( smscore_getbuffer  )
EXPORT_SYMBOL_GPL ( smscore_putbuffer  )
EXPORT_SYMBOL_GPL ( smscore_register_client  )
EXPORT_SYMBOL_GPL ( smscore_unregister_client  )
EXPORT_SYMBOL_GPL ( smsclient_sendrequest  )
struct smscore_buffer_t* get_entry ( struct smscore_device_t coredev)
read

return pointer to next free buffer descriptor from core pool

Parameters
coredevpointer to a coredev object returned by smscore_register_device
Returns
pointer to descriptor on success, NULL on error.

Definition at line 1095 of file smscoreapi.c.

MODULE_AUTHOR ( "Siano Mobile  Silicon,
Inc.(uris @siano-ms.com)"   
)
MODULE_DESCRIPTION ( "Siano MDTV Core module )
module_exit ( smscore_module_exit  )
module_init ( smscore_module_init  )
MODULE_LICENSE ( "GPL"  )
module_param ( default_mode  ,
int  ,
0644   
)
module_param_named ( debug  ,
sms_dbg  ,
int  ,
0644   
)
MODULE_PARM_DESC ( debug  ,
"set debug level (info=1, adv=2 (or-able))"   
)
MODULE_PARM_DESC ( default_mode  ,
"default firmware id (device mode)"   
)
int smsclient_sendrequest ( struct smscore_client_t client,
void buffer,
size_t  size 
)

verifies that source id is not taken by another client, calls device handler to send requests to the device

Parameters
clientpointer to smsclient object returned by smscore_register_client
bufferpointer to a request buffer
sizesize (in bytes) of request buffer
Returns
0 on success, <0 on error.

Definition at line 1256 of file smscoreapi.c.

int smscore_configure_gpio ( struct smscore_device_t coredev,
u32  pin,
struct smscore_config_gpio pinconfig 
)

Definition at line 1287 of file smscoreapi.c.

int smscore_get_board_id ( struct smscore_device_t core)

Definition at line 79 of file smscoreapi.c.

int smscore_get_device_mode ( struct smscore_device_t coredev)

calls device handler to get current mode of operation

Parameters
coredevpointer to a coredev object returned by smscore_register_device
Returns
current mode

Definition at line 920 of file smscoreapi.c.

struct smscore_buffer_t* smscore_getbuffer ( struct smscore_device_t coredev)
read

Definition at line 1109 of file smscoreapi.c.

int smscore_gpio_configure ( struct smscore_device_t coredev,
u8  PinNum,
struct smscore_gpio_config pGpioConfig 
)

Definition at line 1408 of file smscoreapi.c.

int smscore_gpio_get_level ( struct smscore_device_t coredev,
u8  PinNum,
u8 level 
)

Definition at line 1537 of file smscoreapi.c.

int smscore_gpio_set_level ( struct smscore_device_t coredev,
u8  PinNum,
u8  NewLevel 
)

Definition at line 1488 of file smscoreapi.c.

int smscore_led_state ( struct smscore_device_t core,
int  led 
)

Definition at line 71 of file smscoreapi.c.

void smscore_onresponse ( struct smscore_device_t coredev,
struct smscore_buffer_t cb 
)

find client by response id/type, call clients onresponse handler return buffer to pool on error

Parameters
coredevpointer to a coredev object returned by smscore_register_device
cbpointer to response buffer descriptor

Definition at line 972 of file smscoreapi.c.

void smscore_putbuffer ( struct smscore_device_t coredev,
struct smscore_buffer_t cb 
)

return buffer descriptor to a pool

Parameters
coredevpointer to a coredev object returned by smscore_register_device
cbpointer buffer descriptor

Definition at line 1127 of file smscoreapi.c.

int smscore_register_client ( struct smscore_device_t coredev,
struct smsclient_params_t params,
struct smscore_client_t **  client 
)

creates smsclient object, check that id is taken by another client

Parameters
coredevpointer to a coredev object from clients hotplug
initial_idall messages with this id would be sent to this client
data_typeall messages of this type would be sent to this client
onresponse_handlerclient handler that is called to process incoming messages
onremove_handlerclient handler that is called when device is removed
contextclient-specific context
clientpointer to a value that receives created smsclient object
Returns
0 on success, <0 on error.

Definition at line 1179 of file smscoreapi.c.

int smscore_register_device ( struct smsdevice_params_t params,
struct smscore_device_t **  coredev 
)

creates coredev object for a device, prepares buffers, creates buffer mappings, notifies registered hotplugs about new device.

Parameters
paramsdevice pointer to struct with device specific parameters and handlers
coredevpointer to a value that receives created coredev object
Returns
0 on success, <0 on error.

Definition at line 321 of file smscoreapi.c.

int smscore_register_hotplug ( hotplug_t  hotplug)

register a client callback that called when device plugged in/unplugged NOTE: if devices exist callback is called immediately for each device

Parameters
hotplugcallback
Returns
0 on success, <0 on error.

Definition at line 201 of file smscoreapi.c.

int smscore_registry_getmode ( char devpath)

Definition at line 130 of file smscoreapi.c.

void smscore_registry_setmode ( char devpath,
int  mode 
)

Definition at line 157 of file smscoreapi.c.

void smscore_set_board_id ( struct smscore_device_t core,
int  id 
)

Definition at line 66 of file smscoreapi.c.

int smscore_set_device_mode ( struct smscore_device_t coredev,
int  mode 
)

calls device handler to change mode of operation NOTE: stellar/usb may disconnect when changing mode

Parameters
coredevpointer to a coredev object returned by smscore_register_device
moderequested mode of operation
Returns
0 on success, <0 on error.

Definition at line 807 of file smscoreapi.c.

int smscore_set_gpio ( struct smscore_device_t coredev,
u32  pin,
int  level 
)

Definition at line 1333 of file smscoreapi.c.

int smscore_start_device ( struct smscore_device_t coredev)

sets initial device mode and notifies client hotplugs that device is ready

Parameters
coredevpointer to a coredev object returned by smscore_register_device
Returns
0 on success, <0 on error.

Definition at line 486 of file smscoreapi.c.

void smscore_unregister_client ( struct smscore_client_t client)

frees smsclient object and all subclients associated with it

Parameters
clientpointer to smsclient object returned by smscore_register_client

Definition at line 1221 of file smscoreapi.c.

void smscore_unregister_device ( struct smscore_device_t coredev)

notifies all clients registered with the device, notifies hotplugs, frees all buffers and coredev object

Parameters
coredevpointer to a coredev object returned by smscore_register_device
Returns
0 on success, <0 on error.

Definition at line 679 of file smscoreapi.c.

void smscore_unregister_hotplug ( hotplug_t  hotplug)

unregister a client callback that called when device plugged in/unplugged

Parameters
hotplugcallback

Definition at line 242 of file smscoreapi.c.