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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, a/ r# Z' E) x/ i! Y" @$ |2 w% e+ Z
  1. [code]EDMA sample test application/ ^! E- H8 ~) P) {8 a
  2. /*
    0 S4 d; K! T" q/ {
  3. * edma_test.c
    ( ~; N, F; \9 r
  4. *
    7 m) d( v' O: R, t* ~9 T
  5. * brief  EDMA3 Test Application+ j. }' L( }, x/ s
  6. *
    # j# Z  d& I8 [" q* `3 Y
  7. *   This file contains EDMA3 Test code.# ?; }8 w  I  O2 \1 h
  8. *
    6 J1 F! E7 b- N! `  ]6 N! D: m: y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( `; Y! |) f7 `. y/ Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" j/ w- d7 @% s( T1 A
  11. *         TO CHANGE.& R, _$ X. d3 J/ D% n; P
  12. *
    ) S( U4 w* `) M" M6 F" U9 J+ u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 V0 e3 Q5 Q! M3 z! R  X- G  _
  14. *
    ' f* h  \) k1 P& K
  15. * This program is free software; you can redistribute it and/or2 |8 y# D! k1 @7 f, b- k: s
  16. * modify it under the terms of the GNU General Public License as
    . K" T+ E% n' b3 \2 W. L  p
  17. * published by the Free Software Foundation version 2.
      e2 Y1 K, Y& ?4 u: O
  18. *
    ' n' c2 r  A) n# A) A5 x, K4 ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" O1 p! R- i& v
  20. * kind, whether express or implied; without even the implied warranty
    0 n/ ?8 b$ z/ g/ d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: s8 A& U; C5 d3 Z. E
  22. * GNU General Public License for more details." E6 `7 k4 j6 Q
  23. */1 d2 G& t4 m  @( N, y) G( F

  24. ) c& i5 w+ |! a# l$ C
  25. #include <linux/module.h>: X& A/ Y; A3 \* T$ g) k6 ]
  26. #include <linux/init.h>
    / Z6 w8 ?3 r9 m# U3 W0 K) Q. s
  27. #include <linux/errno.h>
    % v% g( J) U7 B# ~
  28. #include <linux/types.h>7 s7 d- Y/ ^  v% h# g' p* s1 R) X
  29. #include <linux/interrupt.h>
    ( D  E, x0 t) ^8 J! g$ a
  30. #include <asm/io.h>$ K2 c. C6 a9 e9 a7 b& ~0 t) L
  31. #include <linux/moduleparam.h>/ ^* j8 p! [  q% |" {. t/ l
  32. #include <linux/sysctl.h>, |3 I2 l1 a* f( }
  33. #include <linux/mm.h>
    . O) a# P" A& x( @+ ?
  34. #include <linux/dma-mapping.h>
      V$ @" `: j0 i* A8 r+ ?1 w. J
  35. - G2 T# {  i8 B/ g3 B) m
  36. #include <mach/memory.h>9 Y" y+ a% @) V5 I
  37. #include <mach/hardware.h>: T: C, n5 a0 C1 T8 Z9 E
  38. #include <mach/irqs.h>
    + e( {: G0 `7 T; Z1 w
  39. #include <asm/hardware/edma.h>8 K& Y2 {) Q/ P+ Z
  40. ! A' E# V7 ~0 }0 ^$ i% N: Z( x4 {
  41. #undef EDMA3_DEBUG( v" C2 e1 C: |  {  J0 A
  42. /*#define EDMA3_DEBUG*/$ ?9 d; J! w+ i# s( K

  43.   w- L# e' I6 \* s
  44. #ifdef EDMA3_DEBUG( z$ q( X6 Y" x6 L5 s; g0 k7 T8 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 }0 f' P: ~2 H/ ?$ h5 S) K- `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 E: S- W) V0 @2 M" ^* k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' g& _( i5 w, X9 M. a
  48. #else8 S  p4 a7 l, [6 S6 K, b
  49. #define DMA_PRINTK( x... ), J2 R: c6 B( e; P$ k/ \8 }0 x' l
  50. #define DMA_FN_IN! ]% P/ r0 z" W
  51. #define DMA_FN_OUT# M6 Q, z  z) C+ L0 K. d" v# P& J
  52. #endif/ e5 B/ u; [" G- @

  53. $ d5 q8 ?4 Z8 X" v: L& G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , C: G7 _8 h& e) w* l( Y
  55. #define STATIC_SHIFT                38 E0 e) Z1 G$ p
  56. #define TCINTEN_SHIFT               20$ S- g* q, R- P; ^
  57. #define ITCINTEN_SHIFT              21& |, F* ^6 Z# t5 X' \
  58. #define TCCHEN_SHIFT                22
    0 Y" O  R$ ^2 y: D  }: F& C  |
  59. #define ITCCHEN_SHIFT               23- x/ r! k. Q; D$ I3 x' M2 t) Y2 h% }

  60. ; K" f) d( N* B# X3 Y% h, ^
  61. static volatile int irqraised1 = 0;- x; @# o: m2 I4 J  C" O
  62. static volatile int irqraised2 = 0;
    0 W4 Q  q, Y( ]0 c9 x
  63. " A6 x* k# N7 X. T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % A1 A" j7 H0 t/ c7 R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 `- r, D5 L( o5 ^! Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! S2 P1 H: @9 \( E' ]  k# t
  67. 4 v8 o# z4 n5 f
  68. dma_addr_t dmaphyssrc1 = 0;
    4 [+ ~. M7 G4 O; I0 }
  69. dma_addr_t dmaphyssrc2 = 0;
    . ?" B* F3 W: B, Z/ }+ G, f' I: i' {
  70. dma_addr_t dmaphysdest1 = 0;9 ~' H, g% G) p
  71. dma_addr_t dmaphysdest2 = 0;: ?; v0 N2 ]. Y* j) _* a

  72.   Q( x3 k$ I$ M. @% |0 U
  73. char *dmabufsrc1 = NULL;
    0 [+ h+ m* O8 h% U) H) @2 @2 m8 Y
  74. char *dmabufsrc2 = NULL;& o1 P( p% c. Z0 A/ V
  75. char *dmabufdest1 = NULL;# A' d9 j  X6 Y
  76. char *dmabufdest2 = NULL;
    9 L: p* N' D1 U( O# s2 [

  77. * v$ q) W5 l5 B) g" q
  78. static int acnt = 512;
    ( H4 h+ {) a# ~3 C
  79. static int bcnt = 8;
    % L5 e2 q- }# N8 |4 Q( k
  80. static int ccnt = 8;# z  P% W: m  x5 @* ^8 ]: V3 A
  81. , c2 u" Z7 I6 M* t( a
  82. module_param(acnt, int, S_IRUGO);, @* e" d# U2 k+ k7 H2 a
  83. module_param(bcnt, int, S_IRUGO);
    - B. A9 j+ n  e& \* z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 s5 ~3 i# S; b
/ L7 q+ n' c6 s* s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% {# d/ Y' P9 M) a0 parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 ]9 G! Z) P8 |8 D! ]/ v) s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. U4 H/ o$ O  e" b
, V9 s& N) P+ F( K0 B3 z9 s6 J/ p  o& K2 Q5 j. T9 L) A  w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-25 21:15 , Processed in 0.039958 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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