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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- S4 i$ W; X" k7 e/ x$ z! ]3 @. v. k
  1. [code]EDMA sample test application
    1 `9 M3 J2 t9 w7 ?) Z) O4 M' J
  2. /*, D, X* |9 I; |0 y2 s3 v
  3. * edma_test.c1 L3 O9 D/ @7 O" `$ k8 u# T
  4. *
    - c0 S+ U  s* S2 A) W. j4 Q
  5. * brief  EDMA3 Test Application
    . C9 Y7 m- V9 K9 N
  6. *# q/ \% F( v6 R/ R  l
  7. *   This file contains EDMA3 Test code.0 N# @/ O$ ^8 ?- W
  8. *- f* I$ [. F5 @: N3 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; x# n9 D" G$ x1 x7 Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 S9 c8 g$ G2 ~2 g$ L5 G
  11. *         TO CHANGE.: l* z2 k" q/ d7 _
  12. *
    ; h  S' ?. E+ \0 j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 i' G7 C4 h/ `8 ?5 z
  14. *
    8 ^5 n8 R3 F( X7 B$ t! }
  15. * This program is free software; you can redistribute it and/or
    ) O& p2 ]$ O, ~2 j- p: f* G
  16. * modify it under the terms of the GNU General Public License as( s8 ~; }- z/ l2 G" L
  17. * published by the Free Software Foundation version 2.
    ! @/ u! S% e! O; e0 T3 z# q
  18. *# e9 Y0 g7 x' k8 D! t7 a3 R3 U$ @+ ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) {; ]* a3 r) F. R% _) _3 W
  20. * kind, whether express or implied; without even the implied warranty3 \  V/ i6 F  E! ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . r$ X6 o4 c; Z2 m
  22. * GNU General Public License for more details.
    9 }" E8 q2 z2 e2 z; W
  23. */
    ' p# b7 f2 W. y# s) m
  24. + }. G, V3 r, j
  25. #include <linux/module.h>
    - W. H  L0 F8 i! E. G8 t# I
  26. #include <linux/init.h>
    $ G. e& X3 H3 l0 ?1 |0 Q
  27. #include <linux/errno.h>
    2 j% K5 I/ q8 ^) i" Z* A( `5 s1 d: F
  28. #include <linux/types.h># s6 G' E. z# Q4 R7 q, J* b0 K. n# T
  29. #include <linux/interrupt.h>
    - G  V' ~  k2 c3 |
  30. #include <asm/io.h>
      w& V- ]) r; P5 |+ k& }: O
  31. #include <linux/moduleparam.h>5 w- W: O" _5 B% ]/ S
  32. #include <linux/sysctl.h>
    $ Y- E) Y0 g0 u- r3 L$ }
  33. #include <linux/mm.h>- d2 \. `4 `! V
  34. #include <linux/dma-mapping.h>) E# i* Q+ K" P9 O
  35. + n2 J3 I' [" w4 B2 a- l9 [2 o
  36. #include <mach/memory.h>
    : g9 z. N% t! d% W
  37. #include <mach/hardware.h>
    $ I- D- V* W$ W$ g  {# {4 n
  38. #include <mach/irqs.h>4 H1 C3 r( U( |6 R5 G0 `- v6 r
  39. #include <asm/hardware/edma.h>1 h* @0 S0 `, q# y  w# J( h# A9 Z

  40. $ o* I. v* y1 r  a
  41. #undef EDMA3_DEBUG
    8 u$ P+ V5 D/ o/ M: m
  42. /*#define EDMA3_DEBUG*/
    ) s+ |7 d$ p- N& E7 J
  43. : y! s% A& B* H. M5 e' o+ C; W4 O7 o
  44. #ifdef EDMA3_DEBUG
    ; f# R0 [; Y; m% l4 F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% R, Y+ v9 O+ Y" C: z) j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 o* O2 q3 D4 \+ q, F9 _3 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 q! r& O* D3 d$ i* p+ ]/ Y
  48. #else, p9 ]7 K) `. ]) o) Z" a. S/ E8 \, _  Q
  49. #define DMA_PRINTK( x... )
    ) Y! h8 M4 p7 L$ f
  50. #define DMA_FN_IN
    - Y  G6 ]. R- h+ T' {2 n
  51. #define DMA_FN_OUT& m2 z5 n' N) b' U
  52. #endif
    + Q  Z/ u+ q1 {. z% K
  53. ' Z2 e" U3 Z, [: ?0 ?8 H+ n# t- L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  X# X2 m2 e! b' i0 B
  55. #define STATIC_SHIFT                3
    2 r2 G0 U) f" y. C: ~
  56. #define TCINTEN_SHIFT               20
    8 Q4 ?5 S2 M6 A% B. x" i0 _, l4 C
  57. #define ITCINTEN_SHIFT              217 p: L# c  p# A8 q$ ], u% f/ _2 H3 R6 ?
  58. #define TCCHEN_SHIFT                22
    ; _& h) J2 A; F8 l: x( H9 P
  59. #define ITCCHEN_SHIFT               23* F6 v. O4 P1 }; Y& x2 t+ h
  60. 1 ]5 |7 ]5 I- j* G
  61. static volatile int irqraised1 = 0;; h9 P4 T& i' i; v; O& K5 K
  62. static volatile int irqraised2 = 0;
    9 R( O- x; E% P: ^- V. A3 h
  63. 5 l5 H9 @5 j6 t- o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# J8 V: x- w1 t* |8 q4 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, _  m) R0 c5 z6 i6 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% E5 y, I* r; |$ U) r

  67. # c& ~3 a# }( H2 `* w
  68. dma_addr_t dmaphyssrc1 = 0;
    6 V0 c0 j3 f# f! ?2 i$ ?
  69. dma_addr_t dmaphyssrc2 = 0;
    8 N; k  e9 H) P& T: I
  70. dma_addr_t dmaphysdest1 = 0;% s# |1 Y- {' K7 j* t4 v, u
  71. dma_addr_t dmaphysdest2 = 0;
    5 d0 R8 g* y! G4 v, K4 o/ _7 E
  72. 6 b3 X2 d, p0 g9 p/ s# E
  73. char *dmabufsrc1 = NULL;. J0 s% A: o4 r  A( y
  74. char *dmabufsrc2 = NULL;* T# `. N: u4 A; Q: Z) X8 X2 s
  75. char *dmabufdest1 = NULL;- f8 Y: o6 G1 N* D# }
  76. char *dmabufdest2 = NULL;
    / R# Q- }! l7 y) q& D: t

  77. ' E( |# `5 W7 E- f9 O
  78. static int acnt = 512;
    + m5 u1 L8 ~  F1 X" `7 Q
  79. static int bcnt = 8;
    1 o+ b3 S2 c* ?3 t4 G5 c8 R8 n
  80. static int ccnt = 8;
    8 J4 W5 q% R$ ~& l7 Z9 M; \8 l

  81. % L+ }9 q- F9 @; G6 e
  82. module_param(acnt, int, S_IRUGO);
    1 S: q; H( Y. ~6 a. Q6 w) G+ h- k
  83. module_param(bcnt, int, S_IRUGO);
    0 n# a1 s# P0 P7 o
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 G5 ?3 T! }3 I% Q* N) L
9 L  F7 |/ z+ o4 M6 j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' C2 F+ k3 D8 O% \& E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  V8 J' f( K! V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) [4 T7 J* A' l4 {  r8 ]
# @7 \0 s7 I& Q" x
2 r  _, z$ t* E& n/ D* ]. v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

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

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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