Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eb0c560

Browse files
committed
Move to version 5 of VCHIQ. Note: this requires a corresponding start.elf and /opt/vc/lib update
1 parent 2843e37 commit eb0c560

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+7481
-15144
lines changed

drivers/misc/vc04_services/Kconfig

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
config BCM2708_VCHIQ
22
tristate "Videocore VCHIQ"
33
depends on MACH_BCM2708
4-
default y
5-
help
6-
Helper for communication for VideoCore.
4+
default CONFIG_BCM_VC_SERVICES
5+
help
6+
Kernel to VideoCore communication interface for the
7+
BCM2708 family of products.
8+
Defaults to Y when the Broadcom Videocore services
9+
are included in the build, N otherwise.
710

Lines changed: 90 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,101 @@
1+
ifeq ($(CONFIG_MACH_BCM2708),y)
2+
3+
##############################################################################
4+
#
5+
# This section is for building the RaspberryPi model
6+
#
7+
##############################################################################
8+
19
obj-$(CONFIG_BCM2708_VCHIQ) += vchiq.o
210

311
vchiq-objs := \
412
interface/vchiq_arm/vchiq_core.o \
5-
interface/vchiq_arm/vchiq_shim.o \
6-
interface/vchiq_arm/vchiq_util.o \
713
interface/vchiq_arm/vchiq_arm.o \
814
interface/vchiq_arm/vchiq_kern_lib.o \
915
interface/vchiq_arm/vchiq_2835_arm.o \
10-
interface/vcos/linuxkernel/vcos_linuxkernel.o \
11-
interface/vcos/linuxkernel/vcos_thread_map.o \
12-
interface/vcos/linuxkernel/vcos_linuxkernel_cfg.o \
13-
interface/vcos/generic/vcos_generic_event_flags.o \
14-
interface/vcos/generic/vcos_logcat.o \
15-
interface/vcos/generic/vcos_mem_from_malloc.o \
16-
interface/vcos/generic/vcos_cmd.o
16+
interface/vchiq_arm/vchiq_proc.o \
17+
interface/vchiq_arm/vchiq_shim.o \
18+
interface/vchiq_arm/vchiq_util.o \
19+
interface/vchiq_arm/vchiq_connected.o \
20+
21+
EXTRA_CFLAGS += -DVCOS_VERIFY_BKPTS=1 -Idrivers/misc/vc04_services -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000
22+
23+
endif
24+
25+
ifeq ($(CONFIG_ARCH_KONA),y)
26+
27+
##############################################################################
28+
#
29+
# This section is for building the Capri/Island model
30+
#
31+
##############################################################################
32+
33+
# Remove the quotes from the platform config name
34+
VCHIQ_PLATFORM_CONFIG = $(patsubst "%",%,$(CONFIG_VCHIQ_PLATFORM_CFG_NAME))
35+
36+
$(info VCHIQ_PLATFORM_CONFIG = $(VCHIQ_PLATFORM_CONFIG))
37+
include $(srctree)/drivers/misc/vc04_services/interface/vchiq_arm/platform-cfg/$(VCHIQ_PLATFORM_CONFIG).mk
38+
39+
$(info Building for MAP build system)
40+
$(info CONFIG_ARCH_KONA = $(CONFIG_ARCH_KONA))
41+
42+
EXTRA_CFLAGS += -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -Wno-declaration-after-statement -Wno-parentheses
43+
44+
EXTRA_CFLAGS += -I"drivers/misc/vc04_services/"
45+
EXTRA_CFLAGS += -I"drivers/misc/vc04_services/interface/vchiq_arm"
46+
EXTRA_CFLAGS += -I"drivers/misc/vc04_services/interface/debug_sym"
47+
EXTRA_CFLAGS += -I"include/linux/broadcom"
48+
49+
EXTRA_CFLAGS += -Werror
50+
51+
VCHIQ_HOST_BUS_ALIGNMENT = 3
52+
53+
EXTRA_CFLAGS += -DOS_ASSERT_FAILURE
54+
EXTRA_CFLAGS += -D__STDC_VERSION=199901L
55+
EXTRA_CFLAGS += -D__STDC_VERSION__=199901L
56+
EXTRA_CFLAGS += -D__VCCOREVER__=0
57+
EXTRA_CFLAGS += -D__linux__
58+
EXTRA_CFLAGS += -D__KERNEL__
59+
EXTRA_CFLAGS += -DVCHIQ_HOST_BUS_ALIGNMENT=$(VCHIQ_HOST_BUS_ALIGNMENT)
60+
EXTRA_CFLAGS += -DVCHIQ_SLOT_PADDING=16
61+
EXTRA_CFLAGS += -DVCHIQ_ARM_SIDE
62+
EXTRA_CFLAGS += -DUSE_VCHIQ_ARM
63+
ifeq ($(VCHIQ_SM_ALLOC),vcddr)
64+
EXTRA_CFLAGS += -DVCHIQ_SM_ALLOC_VCDDR
65+
endif
66+
67+
obj-$(CONFIG_KONA_VCHIQ) += vc-vchiq.o
68+
vc-vchiq-objs := \
69+
interface/vchiq_arm/vchiq_arm.o \
70+
interface/vchiq_arm/vchiq_connected.o \
71+
interface/vchiq_arm/vchiq_core.o \
72+
interface/vchiq_arm/vchiq_kern_lib.o \
73+
interface/vchiq_arm/vchiq_shim.o \
74+
interface/vchiq_arm/vchiq_util.o \
75+
interface/vchiq_arm/vchiq_kona_arm.o \
76+
interface/vchiq_arm/vchiq_$(VCHIQ_PLATFORM)_arm.o \
77+
interface/vchiq_arm/vchiq_version.o \
78+
interface/vchiq_arm/vchiq_proc.o
79+
ifeq ($(VCHIQ_SM_ALLOC),vcddr)
80+
vc-vchiq-objs += \
81+
interface/debug_sym/debug_sym.o
82+
endif
83+
84+
obj-$(CONFIG_KONA_VCHIQ_MEMDRV) += vc-vchiq-memdrv-kona.o
85+
vc-vchiq-memdrv-kona-objs := \
86+
interface/vchiq_arm/vchiq_memdrv_kona.o
87+
88+
genversion = drivers/misc/vc04_services/interface/vchiq_arm/vchiq_genversion
1789

18-
EXTRA_CFLAGS += -DVCOS_VERIFY_BKPTS=1 -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -Idrivers/misc/vc04_services -Idrivers/misc/vc04_services/interface/vcos/linuxkernel
90+
GENVERSION_SRC_ROOT_DIR = .
91+
ifeq ($(CONFIG_ANDROID),y)
92+
GENVERSION_SRC_ROOT_DIR = $(srctree)
93+
endif
1994

95+
$(obj)/interface/vchiq_arm/vchiq_version.c: $(genversion) FORCE
96+
echo "(new) Generating $@ ..."
97+
perl $(srctree)/$(genversion) vchiq $(GENVERSION_SRC_ROOT_DIR) > $@
2098

99+
clean-files := vchiq_version.c
21100

101+
endif

drivers/misc/vc04_services/interface/vchi/connections/connection.h

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved.
2+
* Copyright (c) 2010-2012 Broadcom. All rights reserved.
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License as published by
@@ -19,6 +19,10 @@
1919
#ifndef CONNECTION_H_
2020
#define CONNECTION_H_
2121

22+
#include <linux/kernel.h>
23+
#include <linux/types.h>
24+
#include <linux/semaphore.h>
25+
2226
#include "interface/vchi/vchi_cfg_internal.h"
2327
#include "interface/vchi/vchi_common.h"
2428
#include "interface/vchi/message_drivers/message.h"
@@ -50,15 +54,15 @@ typedef int32_t (*VCHI_CONNECTION_CRC_CONTROL_T)( VCHI_CONNECTION_STATE_T *state
5054

5155
// Routine to create a service
5256
typedef int32_t (*VCHI_CONNECTION_SERVICE_CONNECT_T)( VCHI_CONNECTION_STATE_T *state_handle,
53-
vcos_fourcc_t service_id,
57+
int32_t service_id,
5458
uint32_t rx_fifo_size,
5559
uint32_t tx_fifo_size,
5660
int server,
5761
VCHI_CALLBACK_T callback,
5862
void *callback_param,
59-
vcos_bool_t want_crc,
60-
vcos_bool_t want_unaligned_bulk_rx,
61-
vcos_bool_t want_unaligned_bulk_tx,
63+
int32_t want_crc,
64+
int32_t want_unaligned_bulk_rx,
65+
int32_t want_unaligned_bulk_tx,
6266
VCHI_CONNECTION_SERVICE_HANDLE_T *service_handle );
6367

6468
// Routine to close a service
@@ -116,7 +120,7 @@ typedef int32_t (*VCHI_CONNECTION_HELD_MSG_INFO_T)( VCHI_CONNECTION_SERVICE_HAND
116120
uint32_t *rx_timestamp );
117121

118122
// Routine to check whether the iterator has a next message
119-
typedef vcos_bool_t (*VCHI_CONNECTION_MSG_ITER_HAS_NEXT_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service,
123+
typedef int32_t (*VCHI_CONNECTION_MSG_ITER_HAS_NEXT_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service,
120124
const VCHI_MSG_ITER_T *iter );
121125

122126
// Routine to advance the iterator
@@ -149,7 +153,7 @@ typedef int32_t (*VCHI_CONNECTION_BULK_QUEUE_RECEIVE_T)( VCHI_CONNECTION_SERVICE
149153
void *bulk_handle );
150154

151155
// Routine to report if a server is available
152-
typedef int32_t (*VCHI_CONNECTION_SERVER_PRESENT)( VCHI_CONNECTION_STATE_T *state, vcos_fourcc_t service_id, int32_t peer_flags );
156+
typedef int32_t (*VCHI_CONNECTION_SERVER_PRESENT)( VCHI_CONNECTION_STATE_T *state, int32_t service_id, int32_t peer_flags );
153157

154158
// Routine to report the number of RX slots available
155159
typedef int (*VCHI_CONNECTION_RX_SLOTS_AVAILABLE)( const VCHI_CONNECTION_STATE_T *state );
@@ -159,18 +163,18 @@ typedef uint32_t (*VCHI_CONNECTION_RX_SLOT_SIZE)( const VCHI_CONNECTION_STATE_T
159163

160164
// Callback to indicate that the other side has added a buffer to the rx bulk DMA FIFO
161165
typedef void (*VCHI_CONNECTION_RX_BULK_BUFFER_ADDED)(VCHI_CONNECTION_STATE_T *state,
162-
vcos_fourcc_t service,
166+
int32_t service,
163167
uint32_t length,
164168
MESSAGE_TX_CHANNEL_T channel,
165169
uint32_t channel_params,
166170
uint32_t data_length,
167171
uint32_t data_offset);
168172

169173
// Callback to inform a service that a Xon or Xoff message has been received
170-
typedef void (*VCHI_CONNECTION_FLOW_CONTROL)(VCHI_CONNECTION_STATE_T *state, vcos_fourcc_t service_id, int32_t xoff);
174+
typedef void (*VCHI_CONNECTION_FLOW_CONTROL)(VCHI_CONNECTION_STATE_T *state, int32_t service_id, int32_t xoff);
171175

172176
// Callback to inform a service that a server available reply message has been received
173-
typedef void (*VCHI_CONNECTION_SERVER_AVAILABLE_REPLY)(VCHI_CONNECTION_STATE_T *state, vcos_fourcc_t service_id, uint32_t flags);
177+
typedef void (*VCHI_CONNECTION_SERVER_AVAILABLE_REPLY)(VCHI_CONNECTION_STATE_T *state, int32_t service_id, uint32_t flags);
174178

175179
// Callback to indicate that bulk auxiliary messages have arrived
176180
typedef void (*VCHI_CONNECTION_BULK_AUX_RECEIVED)(VCHI_CONNECTION_STATE_T *state);
@@ -185,7 +189,7 @@ typedef void (*VCHI_CONNECTION_INFO)(VCHI_CONNECTION_STATE_T *state, uint32_t pr
185189
typedef void (*VCHI_CONNECTION_DISCONNECT)(VCHI_CONNECTION_STATE_T *state, uint32_t flags);
186190

187191
// Callback to inform of a power control request
188-
typedef void (*VCHI_CONNECTION_POWER_CONTROL)(VCHI_CONNECTION_STATE_T *state, MESSAGE_TX_CHANNEL_T channel, vcos_bool_t enable);
192+
typedef void (*VCHI_CONNECTION_POWER_CONTROL)(VCHI_CONNECTION_STATE_T *state, MESSAGE_TX_CHANNEL_T channel, int32_t enable);
189193

190194
// allocate memory suitably aligned for this connection
191195
typedef void * (*VCHI_BUFFER_ALLOCATE)(VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, uint32_t * length);
@@ -299,7 +303,7 @@ struct vchi_connection_t {
299303
const VCHI_CONNECTION_API_T *api;
300304
VCHI_CONNECTION_STATE_T *state;
301305
#ifdef VCHI_COARSE_LOCKING
302-
VCOS_SEMAPHORE_T sem;
306+
struct semaphore sem;
303307
#endif
304308
};
305309

drivers/misc/vc04_services/interface/vchi/message_drivers/message.h

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved.
2+
* Copyright (c) 2010-2012 Broadcom. All rights reserved.
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License as published by
@@ -19,8 +19,11 @@
1919
#ifndef _VCHI_MESSAGE_H_
2020
#define _VCHI_MESSAGE_H_
2121

22+
#include <linux/kernel.h>
23+
#include <linux/types.h>
24+
#include <linux/semaphore.h>
25+
2226
#include "interface/vchi/vchi_cfg_internal.h"
23-
#include "interface/vcos/vcos.h"
2427
#include "interface/vchi/vchi_common.h"
2528

2629

@@ -63,7 +66,7 @@ typedef struct rx_msg_slot_info {
6366
struct rx_msg_slot_info *next;
6467
//struct slot_info *prev;
6568
#if !defined VCHI_COARSE_LOCKING
66-
VCOS_SEMAPHORE_T sem;
69+
struct semaphore sem;
6770
#endif
6871

6972
uint8_t *addr; // base address of slot
@@ -84,7 +87,7 @@ typedef struct rx_msg_slot_info {
8487
typedef struct rx_bulk_slotinfo_t {
8588
struct rx_bulk_slotinfo_t *next;
8689

87-
VCOS_SEMAPHORE_T *blocking;
90+
struct semaphore *blocking;
8891

8992
// needed by DMA
9093
void *addr;
@@ -127,7 +130,7 @@ typedef struct {
127130
uint16_t slot_delta; // whether this message indicated slot delta
128131
uint32_t len; // length of message
129132
RX_MSG_SLOTINFO_T *slot; // slot this message is in
130-
vcos_fourcc_t service; // service id this message is destined for
133+
int32_t service; // service id this message is destined for
131134
uint32_t tx_timestamp; // timestamp from the header
132135
uint32_t rx_timestamp; // timestamp when we parsed it
133136
} message;
@@ -156,14 +159,14 @@ struct opaque_vchi_message_driver_t {
156159
VCHI_MDRIVER_HANDLE_T *(*open)( VCHI_MESSAGE_DRIVER_OPEN_T *params, void *state );
157160
int32_t (*suspending)( VCHI_MDRIVER_HANDLE_T *handle );
158161
int32_t (*resumed)( VCHI_MDRIVER_HANDLE_T *handle );
159-
int32_t (*power_control)( VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_TX_CHANNEL_T, vcos_bool_t enable );
162+
int32_t (*power_control)( VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_TX_CHANNEL_T, int32_t enable );
160163
int32_t (*add_msg_rx_slot)( VCHI_MDRIVER_HANDLE_T *handle, RX_MSG_SLOTINFO_T *slot ); // rx message
161164
int32_t (*add_bulk_rx)( VCHI_MDRIVER_HANDLE_T *handle, void *data, uint32_t len, RX_BULK_SLOTINFO_T *slot ); // rx data (bulk)
162165
int32_t (*send)( VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_TX_CHANNEL_T channel, const void *data, uint32_t len, VCHI_MSG_FLAGS_T flags, void *send_handle ); // tx (message & bulk)
163166
void (*next_event)( VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_EVENT_T *event ); // get the next event from message_driver
164167
int32_t (*enable)( VCHI_MDRIVER_HANDLE_T *handle );
165-
int32_t (*form_message)( VCHI_MDRIVER_HANDLE_T *handle, vcos_fourcc_t service_id, VCHI_MSG_VECTOR_T *vector, uint32_t count, void
166-
*address, uint32_t length_avail, uint32_t max_total_length, vcos_bool_t pad_to_fill, vcos_bool_t allow_partial );
168+
int32_t (*form_message)( VCHI_MDRIVER_HANDLE_T *handle, int32_t service_id, VCHI_MSG_VECTOR_T *vector, uint32_t count, void
169+
*address, uint32_t length_avail, uint32_t max_total_length, int32_t pad_to_fill, int32_t allow_partial );
167170

168171
int32_t (*update_message)( VCHI_MDRIVER_HANDLE_T *handle, void *dest, int16_t *slot_count );
169172
int32_t (*buffer_aligned)( VCHI_MDRIVER_HANDLE_T *handle, int tx, int uncached, const void *address, const uint32_t length );
@@ -172,7 +175,7 @@ struct opaque_vchi_message_driver_t {
172175
int (*rx_slot_size)( VCHI_MDRIVER_HANDLE_T *handle, int msg_size );
173176
int (*tx_slot_size)( VCHI_MDRIVER_HANDLE_T *handle, int msg_size );
174177

175-
vcos_bool_t (*tx_supports_terminate)( const VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_TX_CHANNEL_T channel );
178+
int32_t (*tx_supports_terminate)( const VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_TX_CHANNEL_T channel );
176179
uint32_t (*tx_bulk_chunk_size)( const VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_TX_CHANNEL_T channel );
177180
int (*tx_alignment)( const VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_TX_CHANNEL_T channel );
178181
int (*rx_alignment)( const VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_RX_CHANNEL_T channel );

drivers/misc/vc04_services/interface/vchi/vchi.h

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved.
2+
* Copyright (c) 2010-2012 Broadcom. All rights reserved.
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License as published by
@@ -16,14 +16,9 @@
1616
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1717
*/
1818

19-
/*=============================================================================
20-
Contains the protypes for the vchi functions.
21-
=============================================================================*/
22-
2319
#ifndef VCHI_H_
2420
#define VCHI_H_
2521

26-
#include "interface/vcos/vcos.h"
2722
#include "interface/vchi/vchi_cfg.h"
2823
#include "interface/vchi/vchi_common.h"
2924
#include "interface/vchi/connections/connection.h"
@@ -44,6 +39,12 @@ Contains the protypes for the vchi functions.
4439
#define VCHI_BULK_ALIGNED(x) (((unsigned long)(x) & (VCHI_BULK_ALIGN-1)) == 0)
4540
#endif
4641

42+
struct vchi_version {
43+
uint32_t version;
44+
uint32_t version_min;
45+
};
46+
#define VCHI_VERSION(v_) { v_, v_ }
47+
#define VCHI_VERSION_EX(v_, m_) { v_, m_ }
4748

4849
typedef enum
4950
{
@@ -88,8 +89,8 @@ typedef struct vchi_msg_vector_ex {
8889
// Construct an entry in a msg vector for a message handle (h), starting at offset (o) of length (l)
8990
#define VCHI_VEC_HANDLE(h,o,l) VCHI_VEC_HANDLE, { { (h), (o), (l) } }
9091

91-
// Macros to manipulate fourcc_t values
92-
#define MAKE_FOURCC(x) ((fourcc_t)( (x[0] << 24) | (x[1] << 16) | (x[2] << 8) | x[3] ))
92+
// Macros to manipulate 'FOURCC' values
93+
#define MAKE_FOURCC(x) ((int32_t)( (x[0] << 24) | (x[1] << 16) | (x[2] << 8) | x[3] ))
9394
#define FOURCC_TO_CHAR(x) (x >> 24) & 0xFF,(x >> 16) & 0xFF,(x >> 8) & 0xFF, x & 0xFF
9495

9596

@@ -108,15 +109,22 @@ typedef struct
108109

109110
// structure used to provide the information needed to open a server or a client
110111
typedef struct {
111-
vcos_fourcc_t service_id;
112-
VCHI_CONNECTION_T *connection;
113-
uint32_t rx_fifo_size;
114-
uint32_t tx_fifo_size;
115-
VCHI_CALLBACK_T callback;
116-
void *callback_param;
117-
vcos_bool_t want_unaligned_bulk_rx; // client intends to receive bulk transfers of odd lengths or into unaligned buffers
118-
vcos_bool_t want_unaligned_bulk_tx; // client intends to transmit bulk transfers of odd lengths or out of unaligned buffers
119-
vcos_bool_t want_crc; // client wants to check CRCs on (bulk) transfers. Only needs to be set at 1 end - will do both directions.
112+
struct vchi_version version;
113+
int32_t service_id;
114+
VCHI_CONNECTION_T *connection;
115+
uint32_t rx_fifo_size;
116+
uint32_t tx_fifo_size;
117+
VCHI_CALLBACK_T callback;
118+
void *callback_param;
119+
/* client intends to receive bulk transfers of
120+
odd lengths or into unaligned buffers */
121+
int32_t want_unaligned_bulk_rx;
122+
/* client intends to transmit bulk transfers of
123+
odd lengths or out of unaligned buffers */
124+
int32_t want_unaligned_bulk_tx;
125+
/* client wants to check CRCs on (bulk) xfers.
126+
Only needs to be set at 1 end - will do both directions. */
127+
int32_t want_crc;
120128
} SERVICE_CREATION_T;
121129

122130
// Opaque handle for a VCHI instance
@@ -269,7 +277,7 @@ extern uint32_t vchi_held_msg_rx_timestamp( const VCHI_HELD_MSG_T *message );
269277
extern int32_t vchi_held_msg_release( VCHI_HELD_MSG_T *message );
270278

271279
// Indicates whether the iterator has a next message.
272-
extern vcos_bool_t vchi_msg_iter_has_next( const VCHI_MSG_ITER_T *iter );
280+
extern int32_t vchi_msg_iter_has_next( const VCHI_MSG_ITER_T *iter );
273281

274282
// Return the pointer and length for the next message and advance the iterator.
275283
extern int32_t vchi_msg_iter_next( VCHI_MSG_ITER_T *iter,

0 commit comments

Comments
 (0)