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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ a1 I% \% w4 M  d' `3 Q& i- }
  1. [code]EDMA sample test application5 r) e! @( [$ W% \/ Z8 F& o
  2. /*
    2 R* D- ]- U" o/ }4 ?' A% R
  3. * edma_test.c. j4 v; Q/ V( h4 j% \
  4. *
    # d; n$ J1 B2 I4 f
  5. * brief  EDMA3 Test Application1 N: C4 k2 x0 ~8 r
  6. *9 t, b) a+ z# u9 N
  7. *   This file contains EDMA3 Test code.
    ( a, I$ w9 o' z# F7 u, a- H! o4 V
  8. *
    $ N8 H# B3 P/ E2 [! ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) F( [' {. U* l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 u! y; Q0 c$ o) s+ Z" O* R
  11. *         TO CHANGE.
    7 J' C- [$ F$ b" A. w- I( a4 j/ a
  12. *
    + p7 d6 q3 i+ i; n8 f0 [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 o. D8 a( b* |1 [2 S, k5 ?
  14. *0 \9 K3 @5 o# N4 k
  15. * This program is free software; you can redistribute it and/or
    $ k/ z' ~5 k' F  d7 d5 m+ M
  16. * modify it under the terms of the GNU General Public License as
    * G  Z) W2 E! ~
  17. * published by the Free Software Foundation version 2.
    9 `; m2 a) r8 N" u
  18. *
    & {: ?/ ^- n. U9 V, {  k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . r+ F% R% `1 v' _& e: O5 c
  20. * kind, whether express or implied; without even the implied warranty9 i1 V9 B) ?- S  e3 A0 ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& ?% N# b  U! S+ Z2 B3 ~; D$ B
  22. * GNU General Public License for more details.
    ' M4 A* K8 t2 v# G3 g7 p- \
  23. */
    ' w( U* o$ Q7 I1 d" U+ R
  24. 5 p) `( j1 d: i% k' |7 e0 X# [
  25. #include <linux/module.h>1 I& v/ p2 ?. e0 Z: i6 ^% C) W2 v
  26. #include <linux/init.h>" h0 X5 e4 S9 ?- N0 y3 S
  27. #include <linux/errno.h>
    . [: {  T$ z* \# p4 h, D( Z6 ]
  28. #include <linux/types.h>: \/ E+ ~9 M; E; N! i# r0 n
  29. #include <linux/interrupt.h>
    2 b3 y3 t  E! y, t9 [
  30. #include <asm/io.h>9 Y8 P" N) l$ F1 Q/ F$ t8 Z
  31. #include <linux/moduleparam.h>
    & P' U; R; u3 E4 \# Y# z, K. E" m
  32. #include <linux/sysctl.h>
    8 h1 A3 W7 e/ a
  33. #include <linux/mm.h>& f1 k  o0 s8 ^0 S
  34. #include <linux/dma-mapping.h>! k7 d  i6 d+ }# x1 }# Z

  35. & ~% A: `) Z" Z0 U, B9 K% M
  36. #include <mach/memory.h>+ c3 @8 m7 f9 D( N
  37. #include <mach/hardware.h>; a1 T  F8 f8 ~; W' m
  38. #include <mach/irqs.h>
    5 ~2 R* P0 M, p4 J
  39. #include <asm/hardware/edma.h>
    ! ]  Y, u- R4 m5 T6 x$ R$ M3 p, e
  40. $ H5 `6 F; w$ G
  41. #undef EDMA3_DEBUG
    5 n$ ~) m5 Q8 ^! H* y) T  F8 Q
  42. /*#define EDMA3_DEBUG*/% B  l+ t( o. s! K& ~- C) a

  43. ' w/ ?. F0 H. {/ X4 D5 n
  44. #ifdef EDMA3_DEBUG
    ) C/ Q4 U8 X/ ]) n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + x" F% M, B4 H& J9 U/ l4 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ E6 J$ B1 ?& H2 H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 S* B# M& r' M* W
  48. #else5 d/ X6 Z; h# {* R
  49. #define DMA_PRINTK( x... )
    " Q6 P# U# }0 b$ A- ^& i, L
  50. #define DMA_FN_IN
    ' b! V9 x$ a. J' s& ^8 X
  51. #define DMA_FN_OUT
    . e  Z) K. p# J  F6 q3 b
  52. #endif6 A/ q7 M5 t8 Z  x6 W

  53. ; l9 o  Q; {. V, D5 Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 B! u+ Y7 j. f% ]3 t
  55. #define STATIC_SHIFT                3$ P  g9 n9 ?  }1 C- F% J
  56. #define TCINTEN_SHIFT               20
    1 x+ R4 B4 X6 A9 n
  57. #define ITCINTEN_SHIFT              21
    7 H* e( L& }& ^: E
  58. #define TCCHEN_SHIFT                22" f7 y% l' O9 r4 `7 o
  59. #define ITCCHEN_SHIFT               23
    7 c4 n4 V$ b% f) _% y# P

  60. ) r( y8 |1 b7 R1 v+ \$ f) w- _
  61. static volatile int irqraised1 = 0;; K  [% Q5 P+ w
  62. static volatile int irqraised2 = 0;/ n" `# P  @) t1 t0 t
  63. / |2 g8 O/ U  @9 p3 E2 v3 F! k) g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - A& ^- e- n+ d" l* \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 f3 Q6 h) e) I. f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 ?; |0 V$ k& N5 |' K
  67. ) E4 e6 d- P1 z: v8 u9 u; q! h
  68. dma_addr_t dmaphyssrc1 = 0;
    $ A7 |( j6 \2 I9 i
  69. dma_addr_t dmaphyssrc2 = 0;+ t$ c. x# s+ @& U6 U% q; i* r& K
  70. dma_addr_t dmaphysdest1 = 0;
    9 {) k4 z' C. J  r( ?
  71. dma_addr_t dmaphysdest2 = 0;
    2 r7 ~* j0 b" s( S# [, ]* b
  72. . p* W5 I* g$ p: n) o5 e
  73. char *dmabufsrc1 = NULL;- F/ p3 v1 @7 ~& q% F8 ]- W
  74. char *dmabufsrc2 = NULL;; k- ^0 F8 j! Y' S  y
  75. char *dmabufdest1 = NULL;
    $ h+ U8 z, j" L
  76. char *dmabufdest2 = NULL;
    2 r% [1 J. e9 H; m" Z+ {! a# Q

  77. 2 ~0 t/ K; ]. i0 R4 W
  78. static int acnt = 512;
    1 w+ N1 S& ~! ]2 E! ?  A
  79. static int bcnt = 8;; |: H7 c( c( D3 |" Y
  80. static int ccnt = 8;
    9 V) B) u; P- p2 a6 d2 B8 w) ^

  81. ' S' f9 ?- ]; {  s6 G8 ~( ?
  82. module_param(acnt, int, S_IRUGO);5 B% n7 B0 \/ ^+ Q
  83. module_param(bcnt, int, S_IRUGO);
    2 ^9 P8 g6 P& [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* P8 K: O& P0 h- P8 A' `, `+ g4 x8 T
' `' I4 l3 q& p8 n. p+ p* I& P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 f  z+ d" W4 y6 T4 C9 E9 Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ |1 `4 Y7 j2 e+ e% t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 u) ~2 D1 U6 G& b: L" h( y9 Q
3 N) N, d' E8 r* h, i0 R9 D; n) f  D; D. u, T  Y1 s1 C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 12:04 , Processed in 0.044843 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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