aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-08-20 08:26:28 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-08-20 08:26:28 +0000
commit24fc474ac69372d242b32830c981639492bba63a (patch)
tree434f821c44668c3e1ba05d9adedefa9572cd4378 /os
parent45a6b7dc5a1758cb2bc49b0d76effa381043d297 (diff)
downloadChibiOS-24fc474ac69372d242b32830c981639492bba63a.tar.gz
ChibiOS-24fc474ac69372d242b32830c981639492bba63a.tar.bz2
ChibiOS-24fc474ac69372d242b32830c981639492bba63a.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1083 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r--os/io/serial.c12
-rw-r--r--os/io/serial.h3
-rw-r--r--os/io/templates/pal_lld.c30
-rw-r--r--os/io/templates/pal_lld.h6
-rw-r--r--os/ports/GCC/ARMCM3/STM32F103/serial_lld.c6
5 files changed, 48 insertions, 9 deletions
diff --git a/os/io/serial.c b/os/io/serial.c
index 05d258841..30a17ed48 100644
--- a/os/io/serial.c
+++ b/os/io/serial.c
@@ -68,7 +68,15 @@ static const struct SerialDriverVMT vmt = {
};
/**
- * @brief Initializes a generic full duplex driver.
+ * @brief Serial Driver initialization.
+ */
+void sdInit(void) {
+
+ sd_lld_init();
+}
+
+/**
+ * @brief Initializes a generic full duplex driver object.
* @details The HW dependent part of the initialization has to be performed
* outside, usually in the hardware initialization code.
*
@@ -84,7 +92,7 @@ static const struct SerialDriverVMT vmt = {
* some data is written in the Queue. The value can be
* @p NULL.
*/
-void sdInit(SerialDriver *sdp, qnotify_t inotify, qnotify_t onotify) {
+void sdObjectInit(SerialDriver *sdp, qnotify_t inotify, qnotify_t onotify) {
sdp->vmt = &vmt;
chEvtInit(&sdp->d1.ievent);
diff --git a/os/io/serial.h b/os/io/serial.h
index acfb2500f..a70dcf7c4 100644
--- a/os/io/serial.h
+++ b/os/io/serial.h
@@ -99,7 +99,8 @@ struct _SerialDriver {
#ifdef __cplusplus
extern "C" {
#endif
- void sdInit(SerialDriver *sdp, qnotify_t inotify, qnotify_t onotify);
+ void sdInit(void);
+ void sdObjectInit(SerialDriver *sdp, qnotify_t inotify, qnotify_t onotify);
void sdStart(SerialDriver *sdp, const SerialDriverConfig *config);
void sdStop(SerialDriver *sdp);
void sdIncomingDataI(SerialDriver *sdp, uint8_t b);
diff --git a/os/io/templates/pal_lld.c b/os/io/templates/pal_lld.c
new file mode 100644
index 000000000..b830de338
--- /dev/null
+++ b/os/io/templates/pal_lld.c
@@ -0,0 +1,30 @@
+/*
+ ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
+
+ This file is part of ChibiOS/RT.
+
+ ChibiOS/RT is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/RT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * @file os/io/templates/pal_lld.c
+ * @brief PAL subsystem low level driver template
+ * @addtogroup PAL_LLD
+ * @{
+ */
+
+#include <ch.h>
+#include <pal.h>
+
+/** @} */
diff --git a/os/io/templates/pal_lld.h b/os/io/templates/pal_lld.h
index f594dd143..cd68f605d 100644
--- a/os/io/templates/pal_lld.h
+++ b/os/io/templates/pal_lld.h
@@ -18,8 +18,8 @@
*/
/**
- * @file src/templates/pal_lld.h
- * @brief PAL subsystem low level driver template
+ * @file os/io/templates/pal_lld.h
+ * @brief PAL subsystem low level driver header template
* @addtogroup PAL_LLD
* @{
*/
@@ -91,7 +91,7 @@ typedef uint32_t ioportid_t;
/*===========================================================================*/
/* Implementation, some of the following macros could be implemented as */
-/* functions, if so please put them in a file named pal_lld.c. */
+/* functions, if so please put them in pal_lld.c. */
/*===========================================================================*/
/**
diff --git a/os/ports/GCC/ARMCM3/STM32F103/serial_lld.c b/os/ports/GCC/ARMCM3/STM32F103/serial_lld.c
index bf06195be..f58f7aad0 100644
--- a/os/ports/GCC/ARMCM3/STM32F103/serial_lld.c
+++ b/os/ports/GCC/ARMCM3/STM32F103/serial_lld.c
@@ -212,17 +212,17 @@ CH_IRQ_HANDLER(VectorDC) {
void sd_lld_init(void) {
#if USE_STM32_USART1
- sdInit(&COM1, NULL, notify1);
+ sdObjectInit(&COM1, NULL, notify1);
GPIOA->CRH = (GPIOA->CRH & 0xFFFFF00F) | 0x000004B0;
#endif
#if USE_STM32_USART2
- sdInit(&COM2, NULL, notify2);
+ sdObjectInit(&COM2, NULL, notify2);
GPIOA->CRL = (GPIOA->CRL & 0xFFFF00FF) | 0x00004B00;
#endif
#if USE_STM32_USART3
- sdInit(&COM3, NULL, notify3);
+ sdObjectInit(&COM3, NULL, notify3);
GPIOB->CRH = (GPIOB->CRH & 0xFFFF00FF) | 0x00004B00;
#endif
}
ss="cm"> * Description: */ #include <xenctrl.h> #include <stdio.h> #include <stdlib.h> #include <sys/mman.h> #include <errno.h> #include <string.h> #define X(name) [__HYPERVISOR_##name] = #name const char *hypercall_name_table[64] = { X(set_trap_table), X(mmu_update), X(set_gdt), X(stack_switch), X(set_callbacks), X(fpu_taskswitch), X(sched_op_compat), X(platform_op), X(set_debugreg), X(get_debugreg), X(update_descriptor), X(memory_op), X(multicall), X(update_va_mapping), X(set_timer_op), X(event_channel_op_compat), X(xen_version), X(console_io), X(physdev_op_compat), X(grant_table_op), X(vm_assist), X(update_va_mapping_otherdomain), X(iret), X(vcpu_op), X(set_segment_base), X(mmuext_op), X(acm_op), X(nmi_op), X(sched_op), X(callback_op), X(xenoprof_op), X(event_channel_op), X(physdev_op), X(hvm_op), X(sysctl), X(domctl), X(kexec_op), X(arch_0), X(arch_1), X(arch_2), X(arch_3), X(arch_4), X(arch_5), X(arch_6), X(arch_7), }; #undef X int lock_pages(void *addr, size_t len) { int e = 0; #ifndef __sun__ e = mlock(addr, len); #endif return (e); } void unlock_pages(void *addr, size_t len) { #ifndef __sun__ munlock(addr, len); #endif } int main(int argc, char *argv[]) { int i, j, xc_handle; xc_perfc_desc_t *pcd; xc_perfc_val_t *pcv; xc_perfc_val_t *val; int num_desc, num_val; unsigned int sum, reset = 0, full = 0, pretty = 0; char hypercall_name[36]; if ( argc > 1 ) { char *p = argv[1]; if ( p[0] == '-' ) { switch ( p[1] ) { case 'f': full = 1; break; case 'p': full = 1; pretty = 1; break; case 'r': reset = 1; break; default: goto error; } } else { error: printf("%s: [-r]\n", argv[0]); printf("no args: print digested counters\n"); printf(" -f : print full arrays/histograms\n"); printf(" -p : print full arrays/histograms in pretty format\n"); printf(" -r : reset counters\n"); return 0; } } if ( (xc_handle = xc_interface_open()) == -1 ) { fprintf(stderr, "Error opening xc interface: %d (%s)\n", errno, strerror(errno)); return 1; } if ( reset ) { if ( xc_perfc_control(xc_handle, XEN_SYSCTL_PERFCOP_reset, NULL, NULL, NULL, NULL) != 0 ) { fprintf(stderr, "Error reseting performance counters: %d (%s)\n", errno, strerror(errno)); return 1; } return 0; } if ( xc_perfc_control(xc_handle, XEN_SYSCTL_PERFCOP_query, NULL, NULL, &num_desc, &num_val) != 0 ) { fprintf(stderr, "Error getting number of perf counters: %d (%s)\n", errno, strerror(errno)); return 1; } pcd = malloc(sizeof(*pcd) * num_desc); pcv = malloc(sizeof(*pcv) * num_val); if ( pcd == NULL || lock_pages(pcd, sizeof(*pcd) * num_desc) != 0 || pcv == NULL || lock_pages(pcd, sizeof(*pcv) * num_val) != 0) { fprintf(stderr, "Could not alloc or lock buffers: %d (%s)\n", errno, strerror(errno)); exit(-1); } if ( xc_perfc_control(xc_handle, XEN_SYSCTL_PERFCOP_query, pcd, pcv, NULL, NULL) != 0 ) { fprintf(stderr, "Error getting perf counter: %d (%s)\n", errno, strerror(errno)); return 1; } unlock_pages(pcd, sizeof(*pcd) * num_desc); unlock_pages(pcv, sizeof(*pcv) * num_val); val = pcv; for ( i = 0; i < num_desc; i++ ) { printf ("%-35s ", pcd[i].name); sum = 0; for ( j = 0; j < pcd[i].nr_vals; j++ ) sum += val[j]; printf ("T=%10u ", (unsigned int)sum); if ( full || (pcd[i].nr_vals <= 4) ) { if ( pretty && (strcmp(pcd[i].name, "hypercalls") == 0) ) { printf("\n"); for( j = 0; j < pcd[i].nr_vals; j++ ) { if ( val[j] == 0 ) continue; if ( (j < 64) && hypercall_name_table[j] ) strncpy(hypercall_name, hypercall_name_table[j], sizeof(hypercall_name)); else sprintf(hypercall_name, "[%d]", j); hypercall_name[sizeof(hypercall_name)-1]='\0'; printf("%-35s ", hypercall_name); printf("%12u\n", (unsigned int)val[j]); } } else { for ( j = 0; j < pcd[i].nr_vals; j++ ) printf(" %10u", (unsigned int)val[j]); printf("\n"); } } else { printf("\n"); } val += pcd[i].nr_vals; } return 0; }