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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ A; h5 ~" t$ ]% H
  1. [code]EDMA sample test application
    ) a5 q" |  M! ]9 ?7 c6 I" G8 q" O5 n
  2. /*
    . i7 Y0 F! q7 b7 u6 O, i
  3. * edma_test.c
    - N6 N% D' S1 S$ q6 x1 [
  4. *0 O  ?; {* q9 C5 w( ?
  5. * brief  EDMA3 Test Application! i# T( [8 i3 Q$ L5 i) N' N4 b
  6. *$ O0 ]' r8 D% s6 x- g) ^  \( Z
  7. *   This file contains EDMA3 Test code.  y& K! |8 B* o2 S* i+ h  s
  8. *
      Q& {% a7 N- Y( z, k% w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( S& F9 _; K( Z5 d9 M! Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 M+ V% K2 T. K
  11. *         TO CHANGE.
    : [7 ~( }0 u0 ^* _* |5 g
  12. *
    - K0 l# R: w9 o. n- O% x  h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 w+ F& P7 Z" ^$ ]
  14. *
    . g$ l8 K' e8 u4 T) E- g" ?! N; i  k- h
  15. * This program is free software; you can redistribute it and/or9 r% L% H5 ?- Z% }- W% P/ B
  16. * modify it under the terms of the GNU General Public License as
    / F) E3 A9 m7 }) u- k# m' L
  17. * published by the Free Software Foundation version 2.
      R5 v! a4 Z* J3 g& i1 g
  18. *
    6 ^+ F+ t1 ~$ u  y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; g) m4 O. N, l% S, W) i9 V
  20. * kind, whether express or implied; without even the implied warranty
    9 A$ j  G' q! [* R7 O; u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 L$ [3 b$ c  d' y
  22. * GNU General Public License for more details.; r7 F8 ~- A8 T) U/ S( @% X
  23. */
    , l0 ?+ \/ C  X) M, Q6 E
  24. . x: ~; U! L8 l2 s
  25. #include <linux/module.h>0 q! K! R1 f$ e1 Y
  26. #include <linux/init.h>
    / \  r: ~) r" B) H- x" F/ T8 D; u
  27. #include <linux/errno.h>
    1 m3 _) I8 M9 w" V, E
  28. #include <linux/types.h>
    % e, ]5 W4 [8 r+ @) U  x; q1 U, [
  29. #include <linux/interrupt.h>- Y# s! x: G) ]" s+ Q$ l9 @' {
  30. #include <asm/io.h>% N7 V- U3 S2 U, d/ v
  31. #include <linux/moduleparam.h>
    . H% l1 N' D, V3 H% [. G
  32. #include <linux/sysctl.h>, {& ?4 \* S  I; D
  33. #include <linux/mm.h>
    3 l6 `, y' C7 c+ H3 z
  34. #include <linux/dma-mapping.h>
    ) \0 ]( F2 F5 G5 v1 k* m) S* F5 z+ ]
  35. 1 ^) @0 m% [" H6 D
  36. #include <mach/memory.h>1 ]/ d, R6 V" \6 i* d1 l5 M: T8 X
  37. #include <mach/hardware.h>  `& q/ |5 X, w: ~
  38. #include <mach/irqs.h>
    6 m) j, t- G0 w' U9 x) y
  39. #include <asm/hardware/edma.h>
    9 n5 F- w% t$ x7 k

  40. 9 y) @: ^6 U  d  R6 f
  41. #undef EDMA3_DEBUG
    5 U' n5 z( ?! U% ]
  42. /*#define EDMA3_DEBUG*/
    7 z% [2 V, u6 g

  43. # g3 F5 y$ x; x$ \
  44. #ifdef EDMA3_DEBUG# u, h! o9 W+ ^% ^( d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 L$ S; f) @% j! V* n* h% ~5 s8 g: P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 N( c5 T5 o5 L% h2 C5 o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 z: G% ~% B; u, H1 n
  48. #else- j' [9 v- ?& E. g6 o1 O8 Z! `
  49. #define DMA_PRINTK( x... )- |) R2 ^- Z. J; N7 t
  50. #define DMA_FN_IN  a* D+ g& N' G1 Y/ S) p, f
  51. #define DMA_FN_OUT2 D6 W: [$ d' E8 A$ X. U
  52. #endif
    ) V0 T, X8 e. O. J1 U

  53. * @% C* J9 q' |. k3 g  u' e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 y( Y8 Q0 O3 D. t; E
  55. #define STATIC_SHIFT                30 K3 ]% Z8 y" J& s1 R6 P. ^
  56. #define TCINTEN_SHIFT               20% _7 _2 b* ^1 c& E% M: c
  57. #define ITCINTEN_SHIFT              215 x6 p- Q) g. `' S$ @
  58. #define TCCHEN_SHIFT                22$ ^: R6 l) E/ W+ S" T4 ?
  59. #define ITCCHEN_SHIFT               23
    $ e; {& l- U; d0 z2 r

  60. . f' |; a! g* w8 t  y/ N! n
  61. static volatile int irqraised1 = 0;
    & b5 Q; J* b: R& v; W& L7 Z0 `
  62. static volatile int irqraised2 = 0;; M9 \1 L) n: T

  63. : P+ A& u; V0 K" e) s; G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 G7 Z* F8 m! K% j$ t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 x2 C8 @3 F+ j9 q. B, [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # w! X/ R& J: q
  67. 9 p9 `0 E: l5 a
  68. dma_addr_t dmaphyssrc1 = 0;) f, B4 p) a, `' X. G3 X1 k& m
  69. dma_addr_t dmaphyssrc2 = 0;5 l0 C. H# j8 ]4 c
  70. dma_addr_t dmaphysdest1 = 0;
    + c( n/ y- B2 p' M( l2 q
  71. dma_addr_t dmaphysdest2 = 0;1 B' y* `& F; h9 G+ q! H- C  e% z

  72. 1 o& t0 {' P% _1 q$ Y
  73. char *dmabufsrc1 = NULL;( Y% n) F$ M6 p" z4 L1 A
  74. char *dmabufsrc2 = NULL;
    5 X6 J+ ~, P$ Q: O5 W9 m6 N: Y; J
  75. char *dmabufdest1 = NULL;
    . r, P  g9 b+ N  f  O
  76. char *dmabufdest2 = NULL;
    . Q* Y' _/ f/ a' i% E$ O* {! O
  77. 8 {1 j  O  d. F
  78. static int acnt = 512;5 f. r: R7 Z: l) E9 |( \0 y6 t
  79. static int bcnt = 8;
    % k3 [9 _0 R* b8 |, ~9 L
  80. static int ccnt = 8;
    : k" p( G- ?4 R0 r7 j. y7 U3 \
  81. ) u2 g) Z6 m% p7 N, I( a- n) B: U
  82. module_param(acnt, int, S_IRUGO);
    # Y/ h9 q' G! M; v
  83. module_param(bcnt, int, S_IRUGO);
    : {; j9 R+ ]. {2 L5 |* L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 g, i$ `( j  S  y) O8 g
0 u. J9 p  b- ^2 O9 `; d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! s  C1 s% Q) ?! T% [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- h: i1 r: R4 f/ U( y' b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" e! l- P$ h) S0 C, D; L0 J4 k8 X( [! d& h" ~8 t/ R

  I: J, H) x9 e$ S' ?8 X! F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 21:20 , Processed in 0.046977 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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