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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % B8 A$ M! Q& j1 [4 I( ?' T
  1. [code]EDMA sample test application
    ' [! X1 r& z9 D, ~/ `- J
  2. /*# ^: W5 D6 Q7 \5 e& Q) U
  3. * edma_test.c
      b0 H- ?( Z* @2 a8 T/ T4 s4 o
  4. *
    ! l  w# k5 H1 m* ~  ]
  5. * brief  EDMA3 Test Application* i7 Z) O: O0 M0 W# L1 x
  6. *
    3 k2 K% Y4 T* Z; \' [* e! f
  7. *   This file contains EDMA3 Test code.
    7 Z  p5 I  d3 O  \
  8. *6 i8 w- k) P( t" h% o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 B6 e* S" u: e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! H' [+ s" ?& Z( O
  11. *         TO CHANGE.
    2 l4 ?# p3 V7 n( U( I
  12. *
    $ |: \/ f' i1 M) q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; j' k. j$ `+ t. H( A2 b. y
  14. *7 \$ R2 ?5 j1 w, ~1 N
  15. * This program is free software; you can redistribute it and/or" y1 n) K! Q4 ~3 E
  16. * modify it under the terms of the GNU General Public License as; R; f1 r2 m" G' x# y) W5 Y) F
  17. * published by the Free Software Foundation version 2.7 x! T8 b5 |! {+ I- c# f
  18. *' b1 a8 r, S' T1 f6 V5 n7 Z( p, Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # L$ b. X1 i" g6 [
  20. * kind, whether express or implied; without even the implied warranty
    8 D% @2 j  Q1 A- }# ?7 f" g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % C2 X$ W& o. _) }
  22. * GNU General Public License for more details.
    8 Z5 B; j, }8 }! `4 ?7 ?' o
  23. */0 L( I0 w& R- @6 x; ^- _% p6 E
  24. 4 z) f$ c: y$ \9 S" c, s$ t3 \
  25. #include <linux/module.h>
    6 P: P: ^! W6 B: T6 C; j5 ?0 B8 F9 a
  26. #include <linux/init.h>
    5 m" P  D0 e; {% `
  27. #include <linux/errno.h>( I" n# p! b$ N. u$ i. V$ C
  28. #include <linux/types.h>6 `( K6 L: x: n. @7 U
  29. #include <linux/interrupt.h>
    " \+ L+ l7 q) {( K# x
  30. #include <asm/io.h>) k- R7 f& D1 ?: L
  31. #include <linux/moduleparam.h>
    ( S) ^: P) E; M; Z( b) x
  32. #include <linux/sysctl.h>- I  \1 B# N0 q3 j" R9 Y
  33. #include <linux/mm.h>) _4 h6 \7 G/ O. [
  34. #include <linux/dma-mapping.h># h0 j* \1 M: z

  35. 3 t# B' M2 q, |; z4 g! `
  36. #include <mach/memory.h>
    % o4 r3 s. ~1 V
  37. #include <mach/hardware.h>
    7 W: f0 @0 ^4 R3 c  ?0 ]
  38. #include <mach/irqs.h>5 b  w8 w! m$ V! y5 @/ e) d
  39. #include <asm/hardware/edma.h>
    ( A' M) E1 \5 v6 _& L3 @

  40. 5 p3 V5 U1 s2 D
  41. #undef EDMA3_DEBUG
    $ M+ I5 f+ O# N, B9 G' @/ X
  42. /*#define EDMA3_DEBUG*/
    1 S/ U6 Y, B/ j2 R
  43. * C( H4 A! L8 E% M' e* n
  44. #ifdef EDMA3_DEBUG' Z6 L" h0 E8 d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* ~: {, _% y( o( z" J+ Z+ P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 g9 S4 I1 i$ g2 s3 k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), ], f7 V* z) z) k7 }1 A' e. f4 A
  48. #else. |  x( K) ^$ l' F" R; [  k& P" y! F
  49. #define DMA_PRINTK( x... )' z+ Y$ ^+ e8 v  D& B; f% y  [* k
  50. #define DMA_FN_IN5 W1 [$ P$ l- D- a& \9 H# Z4 Q
  51. #define DMA_FN_OUT7 u4 Q( R+ t7 B$ ~$ L5 @
  52. #endif
    3 F8 I0 I) o  K, J

  53. . i3 K( l" m2 U  h- v3 y7 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); I, l  h8 Q4 b
  55. #define STATIC_SHIFT                30 {) a# w/ b+ P, Z6 B$ |
  56. #define TCINTEN_SHIFT               20
    . Z7 @9 a3 I$ v9 f# u# |
  57. #define ITCINTEN_SHIFT              21
    2 k% ?6 t" ]) R+ G$ k  }
  58. #define TCCHEN_SHIFT                22$ N3 u: q( h4 f; z  J
  59. #define ITCCHEN_SHIFT               23
    2 i$ G5 w2 Z, Q' E

  60. ' w4 q+ l" q/ P3 X
  61. static volatile int irqraised1 = 0;, F5 N, b5 b5 [. h, b& g# y
  62. static volatile int irqraised2 = 0;
    . O6 @. \# C% |: P6 \
  63. . V" R4 E6 \0 @9 B* f% [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; o  Q1 u" r3 _7 p+ c4 ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 A  A4 w* C( V% B$ V4 R( y2 T6 O$ f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + i% h, v( M4 k+ M! P/ b5 T

  67. " \- w8 b& I- @4 m2 C7 _* _! Q
  68. dma_addr_t dmaphyssrc1 = 0;1 I& s$ h1 v3 Z, L2 d) ~, u
  69. dma_addr_t dmaphyssrc2 = 0;
    7 F- k- _1 a8 K. j/ G5 J/ d$ d# j! j
  70. dma_addr_t dmaphysdest1 = 0;( S: |5 l" N$ M0 h- w. V8 Y7 R
  71. dma_addr_t dmaphysdest2 = 0;% U/ d! u1 v' R9 y2 S
  72. 4 t& B6 D  m+ X  {( M
  73. char *dmabufsrc1 = NULL;. @$ M9 j$ y4 K7 v1 N6 F9 s( x( _
  74. char *dmabufsrc2 = NULL;
    5 \: }. z2 n0 ]
  75. char *dmabufdest1 = NULL;# o( ~4 t  U# ]
  76. char *dmabufdest2 = NULL;8 M# [# _; u6 @! ]0 L

  77. ( a  q4 N/ k) I9 F/ B
  78. static int acnt = 512;# D' }4 u1 e. d: b3 i
  79. static int bcnt = 8;  w# X- J! h/ f; d6 [, L0 F1 y
  80. static int ccnt = 8;! k- N2 B/ C' w. Q

  81. 0 t" d7 [3 ]$ H0 R* l) X
  82. module_param(acnt, int, S_IRUGO);6 X  o; e9 Y) l. e( T9 e
  83. module_param(bcnt, int, S_IRUGO);$ D& x: b/ z/ K" j! h$ Z& u$ D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 R) n  b4 r6 K" U6 A! J

/ ]  m: D3 x/ ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ A9 n) k6 A: h' q, karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( p; n  ~1 }" ^- h$ A' G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 ^5 F4 w/ p8 c0 [$ I
+ A8 f6 w& [& l& ]" \

$ P- T+ G* v) i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 07:38 , Processed in 0.041164 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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