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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 p7 }" h" E: q1 e' ^) O
  1. [code]EDMA sample test application/ \, X3 C- W! e6 v7 ]/ m$ U$ c
  2. /*
    " J/ d7 P0 ~3 e
  3. * edma_test.c* i" d$ L( u& |( t4 p! R9 ^5 ?7 ]
  4. *; Y) T0 Y5 Z2 J  g
  5. * brief  EDMA3 Test Application) ]' i  P' S2 {
  6. *2 ]7 ?& _  T; P: D
  7. *   This file contains EDMA3 Test code.
    ; n+ R! P+ B/ Y: K; s
  8. *$ W. q! d+ s7 L) S5 N" N4 D8 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' q) i, F% i# o" Y2 _1 v& v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 j9 a- I6 @# L* ~, z+ t
  11. *         TO CHANGE.
    2 |8 F6 K- }" {4 {5 J1 ]# h
  12. *. s$ J. {3 N2 {, b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 V* p' z4 f7 J4 X$ ]9 F
  14. *. A/ y. h  r1 [; ]7 {
  15. * This program is free software; you can redistribute it and/or; o5 b' Z( H: K* u
  16. * modify it under the terms of the GNU General Public License as# l& l2 y- }: f' S% e* h9 d- Z
  17. * published by the Free Software Foundation version 2.9 S* \6 ~3 G" p/ _* ^$ G2 a  L
  18. *
    ) U+ O( q* s4 l' ?& ^9 f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( b0 c6 Y: k* K8 `: K% g7 G9 X
  20. * kind, whether express or implied; without even the implied warranty
    3 l4 f& {; ]5 a2 W! m9 ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / T( ~, {! \& y1 ~7 I
  22. * GNU General Public License for more details." M  i+ e' u: f9 ^) r/ o+ Z: l' t) d
  23. */
    & U8 w" q$ x' s

  24. : n' n. y. i5 m( ~  E
  25. #include <linux/module.h>9 I! R/ ?1 h6 i* h: \6 R
  26. #include <linux/init.h>
    2 {, Y& P; V$ B$ Y
  27. #include <linux/errno.h>3 l- B0 L1 l- i+ ~! Q- m6 O6 C
  28. #include <linux/types.h>: W. @, H9 J: V1 V6 g7 `7 r+ {8 \
  29. #include <linux/interrupt.h>( N( ^8 c7 n& I9 P
  30. #include <asm/io.h>
    ) E% @$ u2 a' F% d
  31. #include <linux/moduleparam.h>: f6 k  i: P* k# V
  32. #include <linux/sysctl.h>; l7 v8 M. [5 O  b# S* x. _0 n
  33. #include <linux/mm.h>2 ?6 p2 s5 l, n! ]1 \8 z, C  D
  34. #include <linux/dma-mapping.h>
    4 K5 f8 I( a' E9 Y

  35. 3 x) D. s9 }  s" i3 g3 _; `
  36. #include <mach/memory.h>
      o. q  P+ |4 N; t
  37. #include <mach/hardware.h>
    ) O8 S6 U/ `. D' ^8 {8 ^
  38. #include <mach/irqs.h>- i( N# j6 J) q/ L/ L
  39. #include <asm/hardware/edma.h>8 R/ Z9 ?* Q  D/ H

  40. 4 D7 b5 ~2 s! ]3 f: y
  41. #undef EDMA3_DEBUG. g! U: \" c& B$ Q9 G1 X
  42. /*#define EDMA3_DEBUG*/6 {9 V, R5 j3 p) V) ~
  43. - U$ l/ }: N9 m5 b  C  o9 X
  44. #ifdef EDMA3_DEBUG  C5 B  ]  S: G- {$ j8 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / F& \: c& N8 Q9 `; A+ h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 U, q. E& O4 C1 Z' O: s3 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): j% o" I9 r7 S- O
  48. #else; C' j1 g7 F7 n6 h3 _% I& ~: j
  49. #define DMA_PRINTK( x... )6 ]; l# H# Q8 `4 w. y
  50. #define DMA_FN_IN. A7 _. _3 a" N0 o% `
  51. #define DMA_FN_OUT
    , {3 B+ {8 p" ~
  52. #endif& b( \1 G8 F# k1 g# ]

  53. ( I$ X3 u. \- ^/ U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 z" L1 F+ n; M( }/ U- `  m: @
  55. #define STATIC_SHIFT                3) t5 U0 a! z6 l+ L
  56. #define TCINTEN_SHIFT               20
    " z9 h2 Z, V. S' X7 L# @
  57. #define ITCINTEN_SHIFT              21
      y$ _/ D; r% {: o
  58. #define TCCHEN_SHIFT                22
    7 @# {7 @$ K7 f& F
  59. #define ITCCHEN_SHIFT               236 q1 H: z! P3 R( j) Z) m0 }
  60. 8 O8 [* o- U  z& P8 U: N- \
  61. static volatile int irqraised1 = 0;
    7 n2 X  D* I  B! P/ B' |
  62. static volatile int irqraised2 = 0;6 r+ j* r' l! \3 M

  63. 9 y: I+ H- ]4 p% [. ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 D# g- z2 ~0 O9 ]" ?. Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: D1 m9 [4 b' g  X4 [9 n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: n. w7 C% t  d
  67. ) Z9 ?* W4 T! I7 }5 e
  68. dma_addr_t dmaphyssrc1 = 0;$ c3 l; l4 p# y
  69. dma_addr_t dmaphyssrc2 = 0;
    ; a' ]* J0 x9 b4 p4 R. F" z
  70. dma_addr_t dmaphysdest1 = 0;
    0 h& }" q* i' b9 h* q9 M6 `. n8 o
  71. dma_addr_t dmaphysdest2 = 0;) T+ g; \: F- F& ~! L
  72. 5 O" B$ ?9 m% k; [' V  |
  73. char *dmabufsrc1 = NULL;( B1 \. w4 Q9 ?/ M4 ^) f- j. a9 p
  74. char *dmabufsrc2 = NULL;% w* U8 L0 D% p, T8 c" t7 n/ ?
  75. char *dmabufdest1 = NULL;
    + ?# ^& t, K2 k
  76. char *dmabufdest2 = NULL;; x5 B! p0 W4 L% J3 s

  77. 4 O  y- B8 P  p' Q. {: z4 r  p
  78. static int acnt = 512;
    4 d% Z) {, k2 y
  79. static int bcnt = 8;
    , p. h: B3 k4 K9 B
  80. static int ccnt = 8;
    * H3 N: Q9 |6 T- R5 a( [1 @1 q
  81. ! Z2 o) \, S4 L, M. M$ K
  82. module_param(acnt, int, S_IRUGO);
    + d& `7 P1 b* L, O- I5 J$ \
  83. module_param(bcnt, int, S_IRUGO);0 v7 ~- R0 X, v9 W# |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) ^' n0 \! [. u+ k3 R
& d0 @' O6 A, H9 V1 |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) P- f7 }! O' e3 c' o- s5 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) y% C" H' v; A9 _) l2 |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 G3 n4 F1 I# H6 i: A

# M4 j3 Z5 M- `* A" Z7 r- D6 ^6 D& x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 20:41 , Processed in 0.048467 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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