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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 o% z! L1 H4 {, M) Z
  1. [code]EDMA sample test application" M$ G4 ^  S+ b  q! D$ J
  2. /*: W6 r6 I  x8 U5 g+ A5 G
  3. * edma_test.c1 h- g9 C6 o8 Z4 {1 j6 f  m: u
  4. *# ^0 b1 L. g9 ?" w; ?6 k2 a
  5. * brief  EDMA3 Test Application
    ; z' ~! r( a- P- m3 y+ c1 R' S6 J& v
  6. *) g2 [  N* C, _5 L" R% X8 _, a
  7. *   This file contains EDMA3 Test code.
    " d- ]5 I! {; O+ @
  8. *
    / D; M0 D# Q$ O2 Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 ~7 h9 B+ d0 P* V( e! S1 P/ A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 T, c/ ^$ s8 f3 R( x& e8 n
  11. *         TO CHANGE.7 D2 q  A$ p+ l! ~
  12. *4 z* p3 F9 g4 }7 e2 o! t5 q# L' D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      Z# Q- I9 N& E
  14. *1 s1 f6 j" I2 ~* P
  15. * This program is free software; you can redistribute it and/or+ u* ?8 `9 @# r5 Z6 M) U
  16. * modify it under the terms of the GNU General Public License as
    * e; n$ C% _/ j" H
  17. * published by the Free Software Foundation version 2.0 @/ R% L' t) i3 H
  18. *
    3 V, ^. j: ~+ o  l, Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" z1 p% p* _3 f9 l' `- g- _
  20. * kind, whether express or implied; without even the implied warranty" n5 \( t7 |* @3 g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# J7 q. l! S' t% L
  22. * GNU General Public License for more details.8 s# C$ Y3 Y6 G' n% H& A4 {
  23. */
    ' B9 _# _3 P. M

  24. 4 q( g* i) f0 V) |+ [& c
  25. #include <linux/module.h>
    ) N) B  ?9 E% s7 [; G: G/ e
  26. #include <linux/init.h>
    ! O1 v+ Q  K8 I! E+ D4 h4 o! T) n
  27. #include <linux/errno.h>
    ! {8 `) n" `8 u/ B3 I' [. F
  28. #include <linux/types.h>
    " b8 X0 o! O$ F
  29. #include <linux/interrupt.h>; B9 [' C( n5 ~8 Y- U
  30. #include <asm/io.h>
    & W- |2 E9 L7 n2 p, c, t3 i; ^
  31. #include <linux/moduleparam.h>
    - {/ r5 _4 F) C. b3 P2 b
  32. #include <linux/sysctl.h>
    ) ?* u) O. q! F& m; {1 f
  33. #include <linux/mm.h>
    4 u6 F7 C# y! ~! ~! D
  34. #include <linux/dma-mapping.h>
    ! K, R2 s! P" f& U4 _4 \
  35. $ l) D6 M; o/ j+ [
  36. #include <mach/memory.h>* g  L- m& c7 N; b' H4 J
  37. #include <mach/hardware.h>1 a7 N+ |* k. X0 e/ L
  38. #include <mach/irqs.h>$ R2 D( C) c% _1 Z. V1 f, _0 v
  39. #include <asm/hardware/edma.h>
    ; @1 U8 h2 }: Q) h
  40. - G# `# n) a+ w" `9 c7 g6 G- X
  41. #undef EDMA3_DEBUG
    ( _8 i: n+ u( l. l# m
  42. /*#define EDMA3_DEBUG*/7 B  i: d' d3 m0 K, P1 G
  43. 8 y, ~$ C' u. P) p
  44. #ifdef EDMA3_DEBUG& p+ R  I& }$ E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( W' H; f# o  i6 H; |* l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ h3 w7 [1 s! d. k* h: X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % U6 R0 y1 u) t  x
  48. #else2 Z9 E% L4 c, ^
  49. #define DMA_PRINTK( x... )0 p$ O9 O4 R" P- K! N
  50. #define DMA_FN_IN  G4 o- Z- v6 g% a8 i. a# `
  51. #define DMA_FN_OUT
    , Q" D# _3 n" |( Q4 z% x$ S" \
  52. #endif
    4 m9 a: `3 q4 x6 j9 {/ p. O' \

  53. 7 j2 V9 N! b# ?% L( J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& e% b0 u0 G- o8 Y9 `7 H
  55. #define STATIC_SHIFT                3* P6 }, k/ W& \' |/ }/ L: }
  56. #define TCINTEN_SHIFT               20
    ; w0 S: Q$ J" m. t; S
  57. #define ITCINTEN_SHIFT              21
    6 a! ^0 c- ^. O' |4 W2 G8 x
  58. #define TCCHEN_SHIFT                22. W- m7 _* r! M. i
  59. #define ITCCHEN_SHIFT               23$ L4 f( C, O! }; c; ~1 X; }7 V8 Y( {

  60. 8 _  j- o+ _: F- Z/ K7 _
  61. static volatile int irqraised1 = 0;0 N* f2 w5 @$ a$ r
  62. static volatile int irqraised2 = 0;$ H, q# Z0 w9 P- E/ Y
  63. ( f) y  E( ?8 l3 y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- _: F; c8 m4 N. F9 }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! T, w, W+ s. B2 v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( X$ ]; H, i" K

  67. + `$ T/ H& g+ b# R# O3 g
  68. dma_addr_t dmaphyssrc1 = 0;
    & h5 P* w1 {/ e: c, r/ D
  69. dma_addr_t dmaphyssrc2 = 0;8 ^9 g7 i5 m4 T" Y" K) p
  70. dma_addr_t dmaphysdest1 = 0;
    4 B1 h/ H4 j. f  Q
  71. dma_addr_t dmaphysdest2 = 0;2 Q5 s$ L; Y# X+ z# I3 \

  72. 4 Z) b. N8 C5 e. B" P
  73. char *dmabufsrc1 = NULL;
      h& e# B4 G% \& P/ P8 A, ]% G3 w
  74. char *dmabufsrc2 = NULL;
    3 t" _; t% U/ b3 ?, u
  75. char *dmabufdest1 = NULL;
    + {- h0 Y' T  ^6 |- q) d. X
  76. char *dmabufdest2 = NULL;
      Y, O! o: ?, f2 C2 F- h
  77. + |4 y4 f2 m5 `; ~; m' U2 t3 n
  78. static int acnt = 512;; Q  w1 S9 w- P  \. ]3 o2 h
  79. static int bcnt = 8;  Y9 ^0 A9 J# M5 T7 J
  80. static int ccnt = 8;0 ^9 K. q  U- B; y7 V

  81. 5 J0 P7 g: m) n/ k
  82. module_param(acnt, int, S_IRUGO);7 p2 ^9 r4 N$ t5 B
  83. module_param(bcnt, int, S_IRUGO);) B2 _) K- ^/ ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 b' m* u9 @* z0 f  O: b; c3 ~6 u. I4 Z- A' Y/ X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ o$ y5 l( I7 M6 _' Q) {4 }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, [+ C0 u  u- A6 C  O* n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ F8 M2 `" y( D" C6 e$ B$ F" B! k" o6 u; Z* H' i2 Z
& O0 j" u/ N# v9 Q% D0 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-2 23:45 , Processed in 0.039796 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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