OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 12298|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' ?8 w& t: U' l0 \1 c
  1. [code]EDMA sample test application4 {7 S' S" [& _1 F5 z7 `6 o
  2. /*: L6 s6 b" I1 \& ~! c
  3. * edma_test.c
    4 H8 d( x. a5 d$ I
  4. *. Z5 u/ T0 d" Q( j, I! i
  5. * brief  EDMA3 Test Application7 ^% a! }! }8 h/ @- C; F
  6. *' g7 l# H5 _# S2 R/ B( l4 L
  7. *   This file contains EDMA3 Test code.
    + H* T5 m% S# `# \  A
  8. *+ n1 w% P7 R9 H3 l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* ?2 Z/ ^3 f4 H% ?( \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 q% L, x  B' N
  11. *         TO CHANGE., Y6 d+ E8 M3 U/ l$ ^% Y4 m
  12. *: Y( m- ~* {% h6 Z9 f' b) C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) U% q2 T& }4 ]% \. p% t, {
  14. *
    # Q0 g4 {  E: K  a- k2 H3 p4 e5 K
  15. * This program is free software; you can redistribute it and/or) A9 H+ b' v0 [: [8 P
  16. * modify it under the terms of the GNU General Public License as
    0 [# B6 P6 h: ]$ W/ Z( U: N) F" ~
  17. * published by the Free Software Foundation version 2.
    ) B% M2 I4 n7 ]* u0 I3 \
  18. *4 h% ~6 w% ^2 p$ W  e. B7 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & P5 M3 K: d& A
  20. * kind, whether express or implied; without even the implied warranty
    ' T+ ?) {1 b. |3 B3 m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) `9 T+ w4 P1 R9 t( S9 m3 B; B
  22. * GNU General Public License for more details.
    & \  @) ^. D0 N/ X  M
  23. */
      |4 u) d  F" H6 o

  24. ' I- K( i- v0 _" [4 g5 N4 j% x
  25. #include <linux/module.h>
    ! G) P& g6 B% l. ^8 J
  26. #include <linux/init.h>
    ! }$ S7 O! E) G% U2 Q  d
  27. #include <linux/errno.h>2 k! t; C9 B! R. {# ?
  28. #include <linux/types.h>( [2 X2 {! c3 Q0 g
  29. #include <linux/interrupt.h>
    : k& o- V& f4 g2 T" \( @/ Y* ]
  30. #include <asm/io.h>
    5 e5 A, y! H4 Q# o9 ?( f
  31. #include <linux/moduleparam.h>
    ' Z3 }6 e: G+ q# K( m9 s$ f
  32. #include <linux/sysctl.h>
    : @) y# a% g! S' B8 m! o- X
  33. #include <linux/mm.h>0 N8 k/ T: Z0 P% o& w4 Y0 q& T
  34. #include <linux/dma-mapping.h>9 z3 r& a# }' L/ @2 b* H; g  Y$ t

  35. 5 i4 {/ }9 _) u5 t# D
  36. #include <mach/memory.h>1 f- V' C1 U/ D8 m1 Z+ s' j
  37. #include <mach/hardware.h>
    : X8 s5 d5 L  W* M/ T6 S
  38. #include <mach/irqs.h>( F  P9 }' }/ P' s
  39. #include <asm/hardware/edma.h>; S, C: X) t  C5 R) F

  40. 9 b. s# U, D* C$ U: d8 [1 U
  41. #undef EDMA3_DEBUG
    ; j& W3 p, `* e1 V- A* k, o
  42. /*#define EDMA3_DEBUG*/
    0 W3 J* P* ?6 q: r9 F+ U0 W

  43. , w9 ?7 v  H9 C* J1 n7 y. T
  44. #ifdef EDMA3_DEBUG+ ?( z, ?: B% k! P# a( i. w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# |5 I' }" O& s, a8 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) |( x- C1 O  m7 l& f$ {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) b8 t# z/ S$ A! k
  48. #else3 w; k( P5 ^& O( L0 ~
  49. #define DMA_PRINTK( x... )  o, d8 V. D" t2 e" ]  {  H. F
  50. #define DMA_FN_IN
    / r+ f0 v) z' s+ r0 L
  51. #define DMA_FN_OUT
    2 c% u/ }/ Z$ G+ R: R2 }- J
  52. #endif' f1 b( Z  ^3 f8 R: V

  53. " g9 q9 W1 n0 [; D8 F% y2 A2 t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . @4 I/ b7 w# D; R" f
  55. #define STATIC_SHIFT                3- B3 n8 d% [: Z  A6 t  v( z4 g( _4 f2 G
  56. #define TCINTEN_SHIFT               20. K1 e1 L% Q, y7 r5 h
  57. #define ITCINTEN_SHIFT              215 a0 d0 V1 y5 w  F- X
  58. #define TCCHEN_SHIFT                22$ f8 q. D6 s6 q6 G
  59. #define ITCCHEN_SHIFT               23
    5 g, O" ^0 t- [; I) Y

  60. & Z! V8 g5 \$ ]2 f. u) G% `4 _
  61. static volatile int irqraised1 = 0;
    ; S" M2 ?* H7 i( v
  62. static volatile int irqraised2 = 0;; e- ^7 r9 }+ Q/ P4 a  `
  63. ( R: G* K! }+ F$ i- {( D0 A/ J+ @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ Q1 b5 e5 u( G* A: S, ]  [& H, r& \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* E" a9 x/ G4 Z( Z7 |' p* L/ a6 w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 ]% B. b3 A+ s& w8 d  J* o

  67. % u# Y6 C8 S" o# K
  68. dma_addr_t dmaphyssrc1 = 0;
    , z  Z2 W) W  j7 G
  69. dma_addr_t dmaphyssrc2 = 0;3 K: N" r0 y& f' M+ [. ^9 M
  70. dma_addr_t dmaphysdest1 = 0;
    8 ~3 H/ X- c3 m# {* X
  71. dma_addr_t dmaphysdest2 = 0;
    ! I" |& {3 `# l& o$ U+ [
  72. ) N  P' ~! g9 C5 X% B# X8 w
  73. char *dmabufsrc1 = NULL;4 k* N0 \2 i! n" U
  74. char *dmabufsrc2 = NULL;/ m& G2 a7 G8 N8 ~! B
  75. char *dmabufdest1 = NULL;
    - B' M2 J# r4 A; P7 H* t* `
  76. char *dmabufdest2 = NULL;
    6 o3 k7 {: n$ }* B( C: [
  77. 2 v- T1 ?2 ^. v9 v* n
  78. static int acnt = 512;
    + {, a/ U8 p3 W3 l; c) r' h
  79. static int bcnt = 8;
    0 P. r7 R5 w# u- ], V! |# Z
  80. static int ccnt = 8;
    - k# o$ N/ r, Y" t+ R! V6 e. r
  81. 3 ]4 W& ]- P% e! \" `$ N
  82. module_param(acnt, int, S_IRUGO);
    1 U) P. a/ }; b3 }% D
  83. module_param(bcnt, int, S_IRUGO);5 {0 g2 Q+ j. D; t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- A. k4 n- j6 p0 o2 j

- x* c7 x' D% r) `3 S5 X$ {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( T' q& k! z7 y$ P4 p
arm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# n. R) t% s2 J0 [$ A- _, Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' `% k+ J  H( A7 i- M* o* r# H) z
: G7 K3 [' @  x+ L3 M8 I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-3-7 11:55 , Processed in 0.044863 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表