OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ Z/ S2 h3 T) G- `- S9 B
  1. [code]EDMA sample test application
    3 w" o- E8 v" h
  2. /*
    , i; q- A: P: f
  3. * edma_test.c! f7 o: g) l4 U0 C5 O
  4. *$ [5 H0 v% i" m  z+ V# @
  5. * brief  EDMA3 Test Application
    ) E# Y4 f( s& n4 H; g. W4 Z0 E' n9 J
  6. *
    # n# o' @2 S: W; M
  7. *   This file contains EDMA3 Test code.% I# z1 s  K! B6 S
  8. *9 I6 z+ O! u5 C5 ^1 T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* I% G3 a- n5 I, e6 w. E" ^' H% J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 k6 e) C7 b1 B1 ]4 u9 [7 j6 ]' m
  11. *         TO CHANGE.
    : X* U- L4 p0 T7 C  O
  12. *0 v% \* T( _/ \+ d1 F! m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 X3 `4 v- S9 Z+ T
  14. *2 p" Z# S( z0 i: k- b4 J
  15. * This program is free software; you can redistribute it and/or
    ' ]/ N4 F/ Q; X( M( I
  16. * modify it under the terms of the GNU General Public License as
    # z9 V! t7 N9 }5 e. ]1 `% ~- F
  17. * published by the Free Software Foundation version 2." g" F6 d, B1 r/ g1 \
  18. *
    9 f9 P! m# S- ^9 @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  M8 i) R. L/ L1 Z5 ^. ^% P
  20. * kind, whether express or implied; without even the implied warranty+ y% G7 Y% B; R# a: ^, K, |4 a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - T! _) l& ^% J/ o2 r0 w
  22. * GNU General Public License for more details.
    # W% n$ [: b1 `6 v( D5 P+ G
  23. */
    + E. X# J# Q& ]" p, B' s8 F
  24. 0 f- Z, G0 j4 M) n, B  [
  25. #include <linux/module.h>
    # g+ @3 s6 {( g$ h& f
  26. #include <linux/init.h>& j, v% s# [, u/ |. V  ]6 f; s
  27. #include <linux/errno.h>
    % D* S. b9 ~' R7 k9 q
  28. #include <linux/types.h>
    # l) Z0 Y( B$ k2 b4 e7 e& Z( A
  29. #include <linux/interrupt.h>
    / x3 }7 ?) j: \0 V9 T. G0 w
  30. #include <asm/io.h>
    " W2 Y) l( |: @: P" T+ O  f
  31. #include <linux/moduleparam.h>. l' [& F, D) _% S5 Z
  32. #include <linux/sysctl.h>0 ^+ n7 T( t% m: B0 x6 c. S
  33. #include <linux/mm.h>( ], O% j( a' I
  34. #include <linux/dma-mapping.h>1 G! f+ ~- D; L, |% l5 J" \! R
  35. ) m6 [6 d1 S( q1 S7 o
  36. #include <mach/memory.h>
    % h: U( A2 }; W: O2 `8 N
  37. #include <mach/hardware.h>
    6 P- ~* B. Z2 K4 F
  38. #include <mach/irqs.h>
    - ]/ g4 j2 W- S! Y7 \1 q! W
  39. #include <asm/hardware/edma.h>* Z5 `$ B* S& U7 @1 f# g4 Z' a

  40. $ {& d% }% |. n
  41. #undef EDMA3_DEBUG
    0 U) ^& a6 {: v4 ?! Q
  42. /*#define EDMA3_DEBUG*/* U( y! }4 q- s! {, W

  43. ; a& k# |& G" ]7 `  D+ c& g
  44. #ifdef EDMA3_DEBUG8 A7 F7 P' P0 |! F) ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ n% m  {4 h6 [: ]2 a" c' X( K0 W; p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% ]/ c' D' G8 O$ ^/ n4 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* V2 B7 [8 Y$ R+ ?; ]: o" z* {, q
  48. #else
    / t0 [3 y' {3 d- _
  49. #define DMA_PRINTK( x... )2 N. k. o5 d% {' d  g
  50. #define DMA_FN_IN
    3 _/ p3 G7 j8 z$ x- O
  51. #define DMA_FN_OUT. B+ f  A! O6 ]5 Y- G4 U7 `
  52. #endif: F+ Q6 n2 S6 H/ h
  53. 8 m3 a. Q- Z5 N. [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) g" _; f3 A: c/ v. y* P0 U
  55. #define STATIC_SHIFT                3
    , r1 H2 J4 c7 r
  56. #define TCINTEN_SHIFT               20
    : d, G, u0 a5 I! E1 G
  57. #define ITCINTEN_SHIFT              21
    & j2 ?& |  B) s1 M: H3 v- G
  58. #define TCCHEN_SHIFT                22
    & T  v8 ^5 s9 D1 c
  59. #define ITCCHEN_SHIFT               236 m, B" s0 s, B
  60. ! u8 z4 h9 G( s6 y1 t
  61. static volatile int irqraised1 = 0;
    $ |8 N* i  _1 y
  62. static volatile int irqraised2 = 0;6 y4 ~$ q% T& u9 Q

  63. - S, n) E3 z% S5 \4 o, D- o- G' u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" ^: g; ~4 Z: t0 z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! c1 R4 Q$ L* ]4 I0 \6 A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 n9 a0 ]# W- |; N/ h, F

  67. ! k& B& _9 l: i
  68. dma_addr_t dmaphyssrc1 = 0;
    9 O& T) M; ~+ D8 y- Y* M
  69. dma_addr_t dmaphyssrc2 = 0;. j0 V! Z: Q7 t: {. v* y4 w
  70. dma_addr_t dmaphysdest1 = 0;# D* [' T& G' z& M
  71. dma_addr_t dmaphysdest2 = 0;$ R; U- |8 \& b4 j
  72. 3 g# n$ R/ m1 I" a* A8 m7 f) _
  73. char *dmabufsrc1 = NULL;
    & C2 K, V6 ]$ }. W- J. u- a" X6 \
  74. char *dmabufsrc2 = NULL;, u7 ^( p! F! F
  75. char *dmabufdest1 = NULL;
      m) o9 {- q; K  K( N3 ~
  76. char *dmabufdest2 = NULL;+ r; o5 s3 L7 Y$ y) q9 C" b

  77. ) e3 c0 m+ r  c* }* r3 W
  78. static int acnt = 512;
    2 Q! V" H- z1 v8 ~6 T0 ?6 y. g7 k
  79. static int bcnt = 8;
      x5 K5 e  P3 B! b8 @# z
  80. static int ccnt = 8;
    / `( w5 x$ Q7 o5 `! b9 |7 ]

  81. . m& ^0 t& A' R( |0 b
  82. module_param(acnt, int, S_IRUGO);- t. ^- e/ e! b  J5 [* M2 ^
  83. module_param(bcnt, int, S_IRUGO);
    " W9 u% T+ Y3 V. u" _. C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 y* O( @8 V4 z$ C
1 s4 @' M0 Q+ B4 a8 c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ e/ S6 q0 J5 X2 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, p8 h+ u5 F* H. \" r$ d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# Y) b* a, E6 n1 a% A

$ I7 ^! H3 y7 N5 Z/ ?+ J5 W' d
, N3 N4 N6 o  n. n4 K* R+ J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 05:03 , Processed in 0.038986 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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