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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- q7 ?& J& b& K2 a$ l' T& i
  1. [code]EDMA sample test application
    / m" c) u8 X( [0 ?* w
  2. /*
    & h3 C1 {2 x- q  p
  3. * edma_test.c- n) k4 d7 J3 T  f" e
  4. *4 L* ~% a. y& [9 _5 j: e' {% N8 M
  5. * brief  EDMA3 Test Application; x7 l1 V5 F1 }* r% |2 @
  6. *0 B# \6 t9 m8 H. o: L+ K% M
  7. *   This file contains EDMA3 Test code.8 i! v. Y2 H& @8 U9 }* m
  8. *# _) F  H" H5 [2 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 v# q! e3 ^5 k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 A. o0 K; b5 A" l5 v; m5 T
  11. *         TO CHANGE.
      q: w7 I5 R7 S# B$ v2 ^7 A3 r  B
  12. *
    . l' f5 G! e, [% W  n$ f+ c% j! E) H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! e$ F; |5 ]6 U) z( z8 B4 R8 w$ Q
  14. *
    0 O5 L9 W! n1 d: l- ?# D$ W
  15. * This program is free software; you can redistribute it and/or
    , W' A- E" L  e' D
  16. * modify it under the terms of the GNU General Public License as6 f8 i% [! [* y, U3 n
  17. * published by the Free Software Foundation version 2.& S% D. K) P4 L4 t6 X
  18. *
    - s5 B  `. ^! w$ ^6 I- |2 l; _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) u4 H8 O$ Y. r
  20. * kind, whether express or implied; without even the implied warranty( w- z4 H( R; m$ Z3 w# u- t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# W9 N0 i" H! |- S
  22. * GNU General Public License for more details.
    0 ]  @$ E9 w5 V) X
  23. */  p6 c* s7 W: L7 a
  24. # L" M" j" F7 T8 A8 |8 B# G
  25. #include <linux/module.h>
    / v' \# p) l* Y2 ]
  26. #include <linux/init.h>/ ^% w0 f) ]' R& J
  27. #include <linux/errno.h>  S- F1 t! i! a
  28. #include <linux/types.h>
    . [& ^! M3 ?$ ]3 j5 l
  29. #include <linux/interrupt.h>0 e' L  s% a. ~. Y
  30. #include <asm/io.h>
    " ?6 B2 x8 V, s: ]( m
  31. #include <linux/moduleparam.h>* w! a/ k1 `4 w7 y% g+ V3 `
  32. #include <linux/sysctl.h>4 v, m3 w9 y, s9 a* G
  33. #include <linux/mm.h>
    2 `7 a* @, v' N( m
  34. #include <linux/dma-mapping.h>
    7 r. d2 i$ r  u: W. h5 \7 K
  35.   E4 J' p' B: Q8 T" i; ?1 Y
  36. #include <mach/memory.h>- [5 V5 U+ S4 M) M
  37. #include <mach/hardware.h>
    % l/ e- s5 m( {7 A' A0 g' s9 c
  38. #include <mach/irqs.h>
    " F; u  x& a4 |- |
  39. #include <asm/hardware/edma.h>
    6 g7 Y8 p1 p, K$ f
  40. & w% L, E( a, i- _/ E
  41. #undef EDMA3_DEBUG7 w, H8 ^3 s8 c
  42. /*#define EDMA3_DEBUG*/
    6 s* P- t' j5 w
  43. * _7 o. T  Q6 U# X' T
  44. #ifdef EDMA3_DEBUG# H7 b8 @, u4 y7 v5 E; n3 U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): @" Y: f. D' t9 `& D1 Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" U0 p% _) `& r, @6 H& r- M' L* ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); a5 S; z* q* Y: g0 l& ~. C
  48. #else8 E1 g! U9 E) [+ A. Y+ `
  49. #define DMA_PRINTK( x... ), m4 ?8 Q; S* I# V7 |7 L5 w
  50. #define DMA_FN_IN
    6 ~& }% i2 J3 Y. Y
  51. #define DMA_FN_OUT
    1 C. S" I, {4 i) P: K! I6 y
  52. #endif/ o- `( L9 r  i9 K

  53. 0 J& T/ ]# Y- [7 O( Z" {' _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). t; D% S. w% ^, e9 E) ?! _; J
  55. #define STATIC_SHIFT                3
    4 J8 D) {3 u# s% N4 J, V% M, n
  56. #define TCINTEN_SHIFT               20
    8 ~8 [; s1 V% t/ C3 N
  57. #define ITCINTEN_SHIFT              21
    7 O: t! F4 A% I7 X7 U
  58. #define TCCHEN_SHIFT                22
    5 a% r  [- `/ r7 t, o
  59. #define ITCCHEN_SHIFT               231 f4 m3 K1 T# \. }! B% N  `

  60. . Z* S$ H$ }" N( e) T8 `( e+ @! K9 a5 {
  61. static volatile int irqraised1 = 0;: [& A+ m' P5 ^
  62. static volatile int irqraised2 = 0;' |5 o* @: O8 W/ r3 e6 _
  63. 0 {0 j$ R7 G# E0 C2 j6 Q: A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 {" q: q& S/ D/ o) r" p+ k' K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: T6 q9 j+ r* z6 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 ?7 ?" j! b- A% c
  67. ' r3 u- T0 ~3 x) N+ H
  68. dma_addr_t dmaphyssrc1 = 0;, Q! h5 M' u6 o
  69. dma_addr_t dmaphyssrc2 = 0;, a7 c8 o% s2 X/ o1 \
  70. dma_addr_t dmaphysdest1 = 0;
    8 K2 Z; e4 V" C. m. {
  71. dma_addr_t dmaphysdest2 = 0;+ L8 @3 |4 |# ?

  72. 9 p& ~$ A5 E; H
  73. char *dmabufsrc1 = NULL;" I$ m) G3 W5 U- k
  74. char *dmabufsrc2 = NULL;# c5 u7 b/ c9 i! m3 \  V2 P1 N
  75. char *dmabufdest1 = NULL;  Y2 m; n7 y2 g7 `
  76. char *dmabufdest2 = NULL;
    ) M! X: {) \$ t7 a
  77. & I7 _; ^% N9 ~
  78. static int acnt = 512;1 e7 X; E+ O/ a, T: ~* B
  79. static int bcnt = 8;* b8 a! W$ b& F4 @) y. V
  80. static int ccnt = 8;; y1 e4 l% v* n7 j+ I: _1 i4 Q
  81. / w% ~/ U, ]! U( T8 E1 ?; ^) Y) F
  82. module_param(acnt, int, S_IRUGO);( C' I; @8 I+ W
  83. module_param(bcnt, int, S_IRUGO);$ G, o. n- y4 G0 s) A/ s6 L6 U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 ~( C5 P9 O& U& v6 q0 [

* L0 l$ D( v* n) k) p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 ?* y" T# q- Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ k# ^: F8 T, m. y/ L/ d% ^5 {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 L8 D% ?$ }; ^4 ~, Z. Z& @: u, Z' l' C* h* A' V$ n

4 b1 b, ]- x6 `  J% Q) _, C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-11 21:57 , Processed in 0.038748 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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