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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ ^9 T6 U( I- E, r' F3 b  f* N
  1. [code]EDMA sample test application
    " G2 b& i. ], i7 o- e
  2. /*
    " h3 v, E6 V5 {, z4 P; D* z
  3. * edma_test.c
    5 @7 ?, W  C$ u" a
  4. *5 {& k$ r9 k) N- G) j5 I2 U) {9 W
  5. * brief  EDMA3 Test Application5 \2 ]+ r) F! K) o2 N' A( d2 T
  6. *
    ' ^9 N2 S" b) Y3 Q: q- K' K" l, P
  7. *   This file contains EDMA3 Test code.+ S/ O, z% n+ ]9 b# H/ o
  8. *
    ! m1 o: w8 a3 i3 }# A7 g) B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - E' C. A4 p" J+ }1 [5 C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" }% \' A: f* l! ?
  11. *         TO CHANGE.  C6 C# M* [2 O* |. I/ `1 i; U! g
  12. *
    ( ]# K% t- A+ M% w: V% o8 G/ ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 a. ~8 B( f2 I$ J. }
  14. *
    3 g0 p6 l' ~' R+ N& S! d, i
  15. * This program is free software; you can redistribute it and/or- c0 B7 t, n. L) w3 l
  16. * modify it under the terms of the GNU General Public License as* z  U) ?2 `0 n0 ?
  17. * published by the Free Software Foundation version 2.
    # |& }/ ^" e' r. Z& L& j
  18. *
    4 C. v6 ]$ w9 ?: w* Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 Z, Q5 P  U- ?* F' E1 m; X
  20. * kind, whether express or implied; without even the implied warranty
    8 f( ?  E! M9 N! D( a7 n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ Q' U  C% V9 U. H, o; l' O
  22. * GNU General Public License for more details.
    5 {& D9 e! b; V/ _* c
  23. */& {2 V3 Y: T4 K4 |+ l  N
  24. " o" a% U7 S) _% L
  25. #include <linux/module.h>
    % w5 ]! ?. ^# T4 p# J: ^% _- }* ?! ~
  26. #include <linux/init.h>( g8 B, y1 K! h1 ]( @  j, R
  27. #include <linux/errno.h>, \" z! f3 b' Q9 H: t6 y
  28. #include <linux/types.h>1 _. ^% X8 v+ U1 E* C3 ^! V/ Z2 L
  29. #include <linux/interrupt.h>: {+ a$ y9 M0 }% E8 `! S
  30. #include <asm/io.h>
    ; u! }+ r- z0 Y: Z+ w
  31. #include <linux/moduleparam.h>: t% T8 h9 H" V  j+ w
  32. #include <linux/sysctl.h>
    " T4 U4 u% P* K1 g1 [1 q
  33. #include <linux/mm.h>
    4 @" ?: h* q' C- _6 \' _
  34. #include <linux/dma-mapping.h>: M8 S  W* r& ^- O7 D) a  j) {: m7 x
  35. : f) ^. h" f  N% ?# u  K
  36. #include <mach/memory.h>7 `" C! ~- B; R1 ]- H" U, C
  37. #include <mach/hardware.h>7 h8 W; @2 b1 q$ ]" ?2 V3 H
  38. #include <mach/irqs.h>
    2 X2 B4 L! A, a3 a- w7 \
  39. #include <asm/hardware/edma.h>
    " D% A0 S& R# J( B

  40. ; d1 K; k. J$ U( x+ s
  41. #undef EDMA3_DEBUG4 ?5 m4 H( o7 e. _. H1 Q
  42. /*#define EDMA3_DEBUG*/
    7 X6 _/ s4 e1 I: o

  43. ) c% U) \: v" x/ r# v1 A1 F- \
  44. #ifdef EDMA3_DEBUG- p9 a* T) e- h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 J" h" u0 T! C# u) b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 I* c/ p4 M' W, M, h8 y$ Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). l1 K! c0 V" o; j) w7 f; b. ~
  48. #else# H) B7 h! \! `6 i
  49. #define DMA_PRINTK( x... )
    5 }5 U: e& e: l. O  F
  50. #define DMA_FN_IN) U& M1 `4 m+ w3 m* d
  51. #define DMA_FN_OUT# }+ ?" i# O/ Q! }1 E+ H
  52. #endif* ~  X+ R6 H% w& v3 }# _

  53. ( a- |! Z# Z  {, ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 I. q7 k( f9 G. }* ^8 d) R
  55. #define STATIC_SHIFT                31 N, Y: Z- I+ L" E+ D& S
  56. #define TCINTEN_SHIFT               20
    , [' A7 b0 ]$ T" f$ R! Y
  57. #define ITCINTEN_SHIFT              21& b. `/ y! v# W2 W! {/ V# V( H
  58. #define TCCHEN_SHIFT                22/ W7 o9 A+ x9 S. D
  59. #define ITCCHEN_SHIFT               23  k3 F1 v$ h; R) Y% Q+ U
  60. 3 M/ o9 N1 M+ m6 y
  61. static volatile int irqraised1 = 0;7 q. d7 r; ~" ^* d( S! Y& i% T
  62. static volatile int irqraised2 = 0;
    6 t6 }  v2 v/ {5 F+ g* ?) ^1 p
  63. . g* s7 Q& f1 F4 P1 s) e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Y$ ^1 n% A5 V& Y& I: y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 x0 @" d  t, v5 _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) u3 K# n: k+ Q) w4 m# ~( f! D

  67. / T5 p8 b! p' K" I
  68. dma_addr_t dmaphyssrc1 = 0;5 ~) `/ T1 v/ z) E3 d- ?) b$ G
  69. dma_addr_t dmaphyssrc2 = 0;9 K4 O7 v& f+ l3 ~5 O$ Z
  70. dma_addr_t dmaphysdest1 = 0;& k- S5 h9 r! n8 s
  71. dma_addr_t dmaphysdest2 = 0;
    ; G: C6 S. T% p1 S

  72. 5 \. E1 b$ y4 h: X! c
  73. char *dmabufsrc1 = NULL;, z7 H6 n% _4 e5 ^/ F
  74. char *dmabufsrc2 = NULL;
    & Q# l+ C  _$ \; g5 w  a( m
  75. char *dmabufdest1 = NULL;: U( Y+ O* i# p: G) w* [# N6 v
  76. char *dmabufdest2 = NULL;
    ; C# J5 ^) C% R* _) j

  77. 4 U$ z( @8 T6 i: Z
  78. static int acnt = 512;9 o( e6 z" i' G! R3 h3 U1 L: E- q
  79. static int bcnt = 8;
    8 O- _$ E3 d4 F
  80. static int ccnt = 8;+ R- m+ O. \! m9 {( x$ v: X7 }, W

  81. 5 @5 M6 d/ N5 X! b( y+ x
  82. module_param(acnt, int, S_IRUGO);
    0 J$ v) i4 [6 Y; B) ^
  83. module_param(bcnt, int, S_IRUGO);
    2 Q* p# |9 E2 J4 Z& C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* R6 C% i  T% `, V$ y2 g
' m; \1 d; R  [6 p3 v: e: J' O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% \# r! T3 m6 Z( ?0 i4 E* @" s# R& J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: ~  ~1 c6 g% {" `2 Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 G4 V4 |; t9 w2 b( ~; M

2 Q/ c8 ^2 F9 v+ V6 v5 v2 c  `4 G% `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 05:17 , Processed in 0.041539 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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