Changeset 850235d in mainline for uspace/drv/infrastructure/rootamdm37x/prm/clock_control.h
- Timestamp:
- 2013-03-10T14:56:21Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 05bab88
- Parents:
- ea906c29 (diff), 2277e03 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/infrastructure/rootamdm37x/prm/clock_control.h
rea906c29 r850235d 1 1 /* 2 * Copyright (c) 2006 Martin Decky 3 * Copyright (c) 2011 Martin Sucha 2 * Copyright (c) 2012 Jan Vesely 4 3 * All rights reserved. 5 4 * … … 28 27 */ 29 28 30 /** @addtogroup fs29 /** @addtogroup amdm37xdrvprm 31 30 * @{ 32 */ 31 */ 32 /** @file 33 * @brief Clock Control Clock Management IO register structure. 34 */ 35 #ifndef AMDM37X_PRM_CLOCK_CONTROL_H 36 #define AMDM37X_PRM_CLOCK_CONTROL_H 37 #include <sys/types.h> 38 #include <macros.h> 33 39 34 /** 35 * @file ext2.c 36 * @brief EXT2 file system driver for HelenOS. 40 /* AM/DM37x TRM p.536 and p.589 */ 41 #define CLOCK_CONTROL_PRM_BASE_ADDRESS 0x48306d00 42 #define CLOCK_CONTROL_PRM_SIZE 8192 43 44 /** Clock control PRM register map 37 45 */ 46 typedef struct { 47 PADD32[16]; 48 ioport32_t clksel; 49 #define CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_MASK (0x7) 50 #define CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_12M (0x0) 51 #define CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_13M (0x1) 52 #define CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_19_2M (0x2) 53 #define CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_26M (0x3) 54 #define CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_38_4M (0x4) 55 #define CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_16_8M (0x5) 38 56 39 #include "ext2fs.h" 40 #include <ipc/services.h> 41 #include <ns.h> 42 #include <async.h> 43 #include <errno.h> 44 #include <unistd.h> 45 #include <task.h> 46 #include <stdio.h> 47 #include <libfs.h> 48 #include "../../vfs/vfs.h" 57 PADD32[12]; 58 ioport32_t clkout_ctrl; 59 #define CLOCK_CONTROL_PRM_CLKOUT_CTRL_CLKOUOUT_EN_FLAG (1 << 7) 49 60 50 #define NAME "ext2fs" 61 } clock_control_prm_regs_t; 51 62 52 vfs_info_t ext2fs_vfs_info = { 53 .name = NAME, 54 .instance = 0, 55 }; 56 57 int main(int argc, char **argv) 63 static inline unsigned sys_clk_freq_kHz(unsigned reg_val) 58 64 { 59 printf(NAME ": HelenOS EXT2 file system server\n"); 60 61 if (argc == 3) { 62 if (!str_cmp(argv[1], "--instance")) 63 ext2fs_vfs_info.instance = strtol(argv[2], NULL, 10); 64 else { 65 printf(NAME " Unrecognized parameters"); 66 return -1; 67 } 65 switch(reg_val) 66 { 67 case CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_12M: return 12000; 68 case CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_13M: return 13000; 69 case CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_19_2M: return 19200; 70 case CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_26M: return 26000; 71 case CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_38_4M: return 38400; 72 case CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_16_8M: return 16800; 68 73 } 69 70 async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE,71 SERVICE_VFS, 0, 0);72 if (!vfs_sess) {73 printf(NAME ": failed to connect to VFS\n");74 return -1;75 }76 77 int rc = ext2fs_global_init();78 if (rc != EOK) {79 printf(NAME ": Failed global initialization\n");80 return 1;81 }82 83 rc = fs_register(vfs_sess, &ext2fs_vfs_info, &ext2fs_ops,84 &ext2fs_libfs_ops);85 if (rc != EOK) {86 fprintf(stdout, NAME ": Failed to register fs (%d)\n", rc);87 return 1;88 }89 90 printf(NAME ": Accepting connections\n");91 task_retval(0);92 async_manager();93 /* not reached */94 74 return 0; 95 75 } 96 76 77 78 #endif 97 79 /** 98 80 * @} 99 */ 81 */
Note:
See TracChangeset
for help on using the changeset viewer.