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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! s, a6 ]- c4 e* m3 R$ ~, W) x
  1. [code]EDMA sample test application( V4 q) k- e2 h% ~6 y  w/ v8 X
  2. /*8 x' r- I) p  k7 a# h
  3. * edma_test.c" E# g6 `" L7 o
  4. *3 V4 J2 w2 V1 `" ^7 B+ s
  5. * brief  EDMA3 Test Application; {+ c) J0 q" {5 `6 R. }2 A
  6. */ d6 \/ ~4 ^$ f; c/ \' a1 X
  7. *   This file contains EDMA3 Test code.
    8 P: e5 O3 {) v/ {
  8. *  `7 U" h* Y6 z$ P7 i0 l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( }+ t% j" B, t4 k8 k+ A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) E; d; i0 j/ m3 ^. T, c+ {$ k& v1 {
  11. *         TO CHANGE.
    # d- a& V6 M+ w" K6 u
  12. *7 |. q3 X+ P6 A  w5 K8 r, g5 k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# b* I5 G9 J, v  u* V
  14. *
    3 A- F+ k, c5 O& J
  15. * This program is free software; you can redistribute it and/or: J9 s2 Z: C# {8 v
  16. * modify it under the terms of the GNU General Public License as
    1 p2 }/ D* l3 n  |5 k; S
  17. * published by the Free Software Foundation version 2.7 W3 l% d; {  v' P. L0 d
  18. *
    0 P  X1 z. ?, A0 j' {2 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 z3 j! W; t/ Y+ w7 X, V
  20. * kind, whether express or implied; without even the implied warranty
    ( h- `& h0 y! m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 a1 N# a) j, `) C3 \# u% G
  22. * GNU General Public License for more details.
    ; |4 B: ]7 M( g. o
  23. *// `7 M! a7 ?5 h. b
  24. ' K: W' r- v& B" t% S' ?; F
  25. #include <linux/module.h># q& Y3 o7 r2 G7 u
  26. #include <linux/init.h>7 w8 q: u/ z1 F. q$ T0 w
  27. #include <linux/errno.h>2 |6 F$ j% D" ]3 r
  28. #include <linux/types.h>2 I( C6 F! h/ g' s1 V6 E
  29. #include <linux/interrupt.h>
    4 o# c8 O8 I( O. z* t" Z$ l9 z
  30. #include <asm/io.h>. `' a0 L4 m! H* @# g
  31. #include <linux/moduleparam.h>2 ~7 X! I, b6 z, d* ~% v5 y; J
  32. #include <linux/sysctl.h>
    8 g/ ?7 D" x* v: Z/ H) Q, W2 A: Y1 V- H! ?
  33. #include <linux/mm.h>5 W* Z/ S6 u/ n2 A- E
  34. #include <linux/dma-mapping.h>
    ( r! C2 y' M+ ?% D. _! F
  35. : V. d9 w+ @1 ^& i: n9 x6 ?
  36. #include <mach/memory.h>3 P2 V3 N% w4 S0 k2 k: V7 V3 j, r0 x
  37. #include <mach/hardware.h>9 u1 ?$ |# \- C& ^% U9 d0 X, K! R
  38. #include <mach/irqs.h>
    , _9 F+ Y; y& z2 g) l# A
  39. #include <asm/hardware/edma.h>, D  y" c: M: Y0 v2 b
  40. 2 \4 I7 n* u. N0 W
  41. #undef EDMA3_DEBUG
    ( Y% a1 Q: L4 f) q+ ^- t
  42. /*#define EDMA3_DEBUG*/+ Q$ ~( m6 ^6 R. E
  43. ( f( L9 o/ `3 T. D/ n
  44. #ifdef EDMA3_DEBUG
    0 U2 A( S: j( R2 D7 g. ]4 j+ n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 ]- E0 v: A8 M- U) b' v  X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 U; B2 }* T, }! b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; E8 X9 g: j5 l
  48. #else
    9 |/ J) U! g" z* C' T( Z( a
  49. #define DMA_PRINTK( x... )
    ) w3 j& |2 [( I" J3 S6 Q
  50. #define DMA_FN_IN& x) l! o6 |4 X8 e, B7 X
  51. #define DMA_FN_OUT' O$ Z6 {& @3 X
  52. #endif
    2 Q; h; w& `0 |+ c" D

  53. . `. u: V' Q: f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " O  {& [7 `  j* e
  55. #define STATIC_SHIFT                3
    7 c2 U6 i* Y- j/ U( ]0 e6 O
  56. #define TCINTEN_SHIFT               20
    7 |; {* l2 a3 k$ G* M
  57. #define ITCINTEN_SHIFT              21
    0 H; H: Y- h0 c4 {8 I, h
  58. #define TCCHEN_SHIFT                22
    9 w1 V) X9 \5 l0 G6 ~/ |
  59. #define ITCCHEN_SHIFT               23
    9 s, O* O; }/ X* p; v1 R  a5 X

  60. / F+ ^4 _2 f" b. y- ?$ M! y
  61. static volatile int irqraised1 = 0;
    9 f0 M+ V6 ~% z+ N+ P+ Z
  62. static volatile int irqraised2 = 0;2 ]! W  W, R1 O
  63. $ \  e7 @* L, n" r; v8 b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 h( z- X8 O3 P$ x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ C% `# E9 ^$ s* @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 l  G8 @  d5 r- N, M
  67. + ^" N( M3 V2 Q  p3 Z+ K
  68. dma_addr_t dmaphyssrc1 = 0;7 K( T1 k4 g% z( k' z3 V9 Y2 @8 t
  69. dma_addr_t dmaphyssrc2 = 0;$ r6 Q6 X: R* g( I! `$ s7 D
  70. dma_addr_t dmaphysdest1 = 0;: W& K- _' l4 |5 h: F+ A
  71. dma_addr_t dmaphysdest2 = 0;
    9 q7 U/ h7 Y) O0 O* K

  72. 0 M2 j3 b. @- m* y0 h
  73. char *dmabufsrc1 = NULL;
    . A8 ]  z5 _+ f4 x$ U
  74. char *dmabufsrc2 = NULL;
    ) `; D2 u% j6 a8 ~
  75. char *dmabufdest1 = NULL;
    2 }) Q0 @4 c* }* J, T4 @6 W6 l9 o
  76. char *dmabufdest2 = NULL;5 t. ]$ d! C! c1 K( u

  77. 3 {4 y: p: z9 G9 W/ ^5 `' m
  78. static int acnt = 512;% @4 r1 B; D9 e
  79. static int bcnt = 8;- y  \. }6 Z3 `& E
  80. static int ccnt = 8;% a9 S& g% F& M* M3 Z* ?
  81. : J' O: q( z! I/ [
  82. module_param(acnt, int, S_IRUGO);% Y" u- ~1 p1 f% r! S5 I; I2 W
  83. module_param(bcnt, int, S_IRUGO);& G, c* n3 u6 U8 m4 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 G  b$ t; ^3 X2 \1 f. E6 L. F% r3 P. u% E: f/ m5 x2 s' B# ~/ j
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ R2 d2 f1 F! Q7 L$ warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; b3 t% e! O5 n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 F7 I7 H" x! U/ y: n! W8 {" ]
- T5 a0 I7 S) Q. U# m7 C2 L
3 N: i0 ~" g$ k  p; C4 b- b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 12:09 , Processed in 0.039910 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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