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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 g$ x6 t5 a2 [& S- l
  1. [code]EDMA sample test application
    ( |: P  I3 ^+ K9 a, k) D6 ?
  2. /*
    & l0 L$ U; K0 {0 m
  3. * edma_test.c' c- |+ ^3 b4 P3 _& a: t. U5 W
  4. *0 }: a3 g" n8 h1 T! I; j* D  X
  5. * brief  EDMA3 Test Application
    . t1 S! h# I1 G2 u7 R
  6. *
    # `' K* m$ p' l6 |3 G
  7. *   This file contains EDMA3 Test code.
    ' `! N5 L4 r7 u- |6 Z9 Z
  8. *5 N7 I+ ?1 W+ G4 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ e4 X( J- z3 s! @, k3 z, L# I% P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! L* Z: F  g4 c$ ?* G: D
  11. *         TO CHANGE.
    $ \0 K2 o1 z% \7 {
  12. *( n  l0 M) d! g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! l4 H+ M# }% d$ O, x) D- \9 K
  14. *& e7 c- J% Y# ^/ k' Z6 F
  15. * This program is free software; you can redistribute it and/or' y+ ^5 w- q4 B- s! [
  16. * modify it under the terms of the GNU General Public License as6 u+ }; z8 w3 ?4 I$ T! K% T4 A7 X- O( a
  17. * published by the Free Software Foundation version 2.: s& o  S+ D# |) {) l
  18. *2 E& S1 k3 u4 f8 F% J' A. L, ?2 ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 Z. Y$ u0 Z, z1 a4 V* H2 n- B
  20. * kind, whether express or implied; without even the implied warranty& Q  c) W. p6 D7 ~( M' |8 J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! z( q' j" j) R
  22. * GNU General Public License for more details.
    8 t: \# C: C9 \: ^" c
  23. */
    1 h/ W9 l2 X( w. s2 e, x: ~8 f
  24. , Y8 H* Q$ Q$ |6 R  o
  25. #include <linux/module.h>
    # h& m% T# w# R- Q3 Y7 [- l3 y
  26. #include <linux/init.h>
    1 o2 t+ @% _( d$ E
  27. #include <linux/errno.h>) O" J) g* {9 j+ I) N
  28. #include <linux/types.h>
    3 ?+ n5 S, ~  H# }- i( p. A
  29. #include <linux/interrupt.h>& h1 [# D5 {" J4 u7 E
  30. #include <asm/io.h>
    % s4 O- H+ A% R1 E  n& ?. h
  31. #include <linux/moduleparam.h>
    ) D- a) I. z& i/ b' H0 K% Z* m
  32. #include <linux/sysctl.h>
    " O& H$ M' d* ?& L, z3 C' w" R
  33. #include <linux/mm.h>
    , A) a6 N# B, f3 U" \
  34. #include <linux/dma-mapping.h>
    & q8 P. Z% i& i6 C

  35. 3 g' _# z/ ~4 O- v
  36. #include <mach/memory.h>' \5 R$ [0 ^! x5 x  C& Q
  37. #include <mach/hardware.h>
    - K" a9 V% |: H2 N" O/ q9 V  X
  38. #include <mach/irqs.h>
    : a5 ~& A0 {, U3 Y: A' h
  39. #include <asm/hardware/edma.h>' _! H% K4 ~- b- O; _. _

  40. * Y* U  G6 U+ g9 e
  41. #undef EDMA3_DEBUG  J: j: ]7 X: N  {
  42. /*#define EDMA3_DEBUG*/
    7 j5 D, z* i4 @1 G

  43. 8 i/ J  X1 U$ L% D1 i$ S% R2 S
  44. #ifdef EDMA3_DEBUG
    & }! A8 [+ |1 o, N0 X% ]. m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 S# @. q8 B: \- i5 }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * v+ r. C- R/ X1 {0 u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% `+ j4 U( i+ Q# w4 J
  48. #else
    ! P1 D6 f5 h) U8 T( F! N0 U) `1 L
  49. #define DMA_PRINTK( x... )
    3 l! I& b( y8 h. V1 n* F
  50. #define DMA_FN_IN# t  T4 K( N/ o
  51. #define DMA_FN_OUT* F- [) q8 f# X  I; p  G* L, X+ j
  52. #endif4 f: a5 v( |* E8 O9 W

  53. 9 k$ k) m* M( f1 e( l) Q2 j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 B$ j. |9 I3 @* f2 p
  55. #define STATIC_SHIFT                3; d+ G' }( j8 p6 _) F
  56. #define TCINTEN_SHIFT               20) N6 L7 A# _+ M
  57. #define ITCINTEN_SHIFT              21
    ( @5 T$ R" S& V- \% t' a
  58. #define TCCHEN_SHIFT                22
    8 ]1 q$ L1 d6 O
  59. #define ITCCHEN_SHIFT               234 J5 x8 S2 P& x0 ?9 S
  60. ( U1 U) h- g$ x& N/ C" k
  61. static volatile int irqraised1 = 0;, S" @1 t& I9 \% \6 o- R
  62. static volatile int irqraised2 = 0;" m4 H9 p- q. b1 L4 t3 _' J" \/ e

  63. 9 b, ~! d/ u: s3 i- k$ s4 g" }3 q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  ]4 U! m  p+ G  |& o# g# e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( K  P" m) J/ f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 C( A" D  y( E9 K9 E$ c

  67. / P/ c) B4 g5 H6 q4 V- e3 I
  68. dma_addr_t dmaphyssrc1 = 0;
    8 w. r" M7 T2 w
  69. dma_addr_t dmaphyssrc2 = 0;
    $ H$ C  V3 {) \+ |
  70. dma_addr_t dmaphysdest1 = 0;
    ! _% T( C6 S( X2 |& d
  71. dma_addr_t dmaphysdest2 = 0;
    : D( D$ s2 q+ \" z1 ]
  72. / ^" A, i5 K/ ?8 G4 E* I+ c
  73. char *dmabufsrc1 = NULL;
    6 [2 |5 p& ]" K4 |; Z3 J
  74. char *dmabufsrc2 = NULL;
    + W1 G9 b' q+ z  x/ m
  75. char *dmabufdest1 = NULL;
    . o6 [1 d, r! L/ E3 F% \9 K4 a
  76. char *dmabufdest2 = NULL;4 m0 ?. l& b4 i+ t' i

  77. 6 A6 o# X( h+ b$ i, |/ W
  78. static int acnt = 512;
    6 P+ C) |+ E6 \- H
  79. static int bcnt = 8;
    9 _6 ^  M" Y; {5 ~5 \
  80. static int ccnt = 8;/ Y3 {3 R# d; x! i5 k# ?

  81. $ ?* ]# g9 D3 J+ K
  82. module_param(acnt, int, S_IRUGO);; }# d2 p- h: \6 }+ T' x
  83. module_param(bcnt, int, S_IRUGO);8 W7 [8 d5 j' z1 y5 n: n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& O/ v% H1 I  G9 G) e+ Z; E

2 o3 m' U  Y2 b% V, @' W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) d# F2 s3 m8 K& o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ W& B5 t# ?; |( K8 f# r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" W! v, |1 s3 [! k! X! j' a
: Q  z8 f- `: K8 J; u+ \5 _

2 c2 n5 o+ ?) f3 r: w. o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 00:26 , Processed in 0.038205 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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