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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + z5 D7 }/ v; d$ q7 \
  1. [code]EDMA sample test application
    4 k, x- o: v2 X; u4 k
  2. /*
    7 [1 Y5 t) y7 X4 D$ y
  3. * edma_test.c1 C. H' e8 `/ Z7 l0 B! E
  4. *. B2 A6 z+ w5 Z3 H$ |% \
  5. * brief  EDMA3 Test Application% O8 G2 d. O; e9 U
  6. *1 r* B- w0 L1 t
  7. *   This file contains EDMA3 Test code./ A6 ^, ~' G6 y
  8. *
    3 V4 v* `( r8 p# K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ t3 \. o) s8 Q7 v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 ?8 g6 Z7 j8 N8 x0 Z
  11. *         TO CHANGE.3 f- [+ A0 f1 |' F* @. B* f
  12. *; W  }+ Q( ?* I6 l' k! B2 O, V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      A( ?1 f: J; n2 }. f+ v8 a9 d
  14. *
    ) H" ^4 P# r% r. h
  15. * This program is free software; you can redistribute it and/or
    6 J+ A1 r) X( Q* Y/ V" \
  16. * modify it under the terms of the GNU General Public License as
    % I3 h$ C  v! i  {1 z
  17. * published by the Free Software Foundation version 2.7 G$ a2 t. j" a
  18. *6 N) D* y; f9 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 T  y" \4 |6 }+ H
  20. * kind, whether express or implied; without even the implied warranty- [7 y5 F/ N" x* j- S1 K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 g1 D0 d' J) T4 \" g
  22. * GNU General Public License for more details.
    7 W& n* D" P- I: u/ H# E+ V
  23. */  ]3 E) i9 G  q9 h1 b' {2 k9 A4 L
  24. ' S+ r* I* X6 E* E6 |1 q
  25. #include <linux/module.h>
    4 L( j; Q- ], @
  26. #include <linux/init.h>: s* O$ l/ I+ C3 H% G) p  V
  27. #include <linux/errno.h>" E) y) ^+ C6 C
  28. #include <linux/types.h>  L. P9 c( C* K5 Q! D( ^- F- w' \$ B
  29. #include <linux/interrupt.h>
    9 a& p1 W/ i/ ^  g4 i- K
  30. #include <asm/io.h>
    & |5 m% s% P8 l& J
  31. #include <linux/moduleparam.h>' a: O) w/ [) n- R; Q0 H: Q  i
  32. #include <linux/sysctl.h>
    1 W" s1 l% i  h) }
  33. #include <linux/mm.h>
    7 e# ]7 }0 Z4 c9 K& q5 x# l9 _
  34. #include <linux/dma-mapping.h>; w: j5 A9 K5 b3 u* M
  35. + j8 |/ G5 e; i5 q9 @/ z" J
  36. #include <mach/memory.h>. _6 q% m, y4 B' R( |# T- i5 F
  37. #include <mach/hardware.h>
    $ F( Q2 \! ~  U  Y  ?7 a% J) o1 M
  38. #include <mach/irqs.h>
    ( R1 B6 r' O1 q2 F  s1 M8 F7 i1 Q
  39. #include <asm/hardware/edma.h>% r, U4 p4 T/ Y: _: M3 w

  40. % f# N9 }* z& h2 l& \6 `
  41. #undef EDMA3_DEBUG
    / v7 \" K# T4 y( P' ^% a; \
  42. /*#define EDMA3_DEBUG*/9 i# t9 e) K) I; O
  43. + E0 Q5 W- v* S+ R! y) P
  44. #ifdef EDMA3_DEBUG
    ; `! @5 H. }# [- S/ T3 j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' x: V3 o- F% Q& Y/ b; o: h7 S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 b5 l+ M4 c" `( n9 v0 d* j2 W& `1 Q* O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 w5 J0 z% L0 O$ n
  48. #else5 [8 O2 c0 `0 ?* H: e( P
  49. #define DMA_PRINTK( x... )# `1 F/ Z/ |8 e7 D
  50. #define DMA_FN_IN7 V6 M; g2 {: g7 G
  51. #define DMA_FN_OUT
    1 {3 Z2 K4 z" z3 s5 t4 M( v' F6 K
  52. #endif5 H) E3 t2 ]9 a% Q4 O2 I  ?3 E
  53. / t7 x" L& Z* u, e1 W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - ]& m0 W$ X* k+ b7 v
  55. #define STATIC_SHIFT                3
    & w4 d) R# y4 U$ [8 }
  56. #define TCINTEN_SHIFT               20" I5 l) L4 h  F) R6 ^
  57. #define ITCINTEN_SHIFT              21" h0 Q% v$ u2 ]2 |+ i3 H
  58. #define TCCHEN_SHIFT                22' k" J! @" `0 b& \+ g
  59. #define ITCCHEN_SHIFT               23) Q& `& q3 m! i' n, H& n
  60. 7 _# c; T2 o7 a/ S% V# V
  61. static volatile int irqraised1 = 0;9 b! I* H* L. C* \' ?
  62. static volatile int irqraised2 = 0;2 o: u- e- C* c! a3 h0 D+ s

  63. $ D! `* t- A# Y( a' ?, |) \6 {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 j& q$ G  [- o7 k  K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) L% P' I+ O+ y8 I# H8 u6 \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) \& C' u+ G) D* M# y0 @+ V
  67. % l. m) ?; b8 u' e% z" ~, M
  68. dma_addr_t dmaphyssrc1 = 0;
    / V9 t6 g$ {0 Q; e+ a- ~
  69. dma_addr_t dmaphyssrc2 = 0;- K; ]' k! L# F9 ^! t% e6 E
  70. dma_addr_t dmaphysdest1 = 0;
      B% P' S  k' e
  71. dma_addr_t dmaphysdest2 = 0;7 \3 v1 t' _& K' t6 R/ S
  72. 7 M- u' L  o) ^
  73. char *dmabufsrc1 = NULL;; p  \! W% t5 C9 P( ~. E0 L
  74. char *dmabufsrc2 = NULL;  y# V3 y5 g0 \3 B1 {/ w
  75. char *dmabufdest1 = NULL;# e" s# k6 e+ ^5 R
  76. char *dmabufdest2 = NULL;
    $ h  D# A/ }' D

  77. % h/ W% R' N5 y1 ]4 \
  78. static int acnt = 512;
    0 h6 M* w9 E+ g$ H; }
  79. static int bcnt = 8;
    " Y# K' n# i4 }* ~# \9 P, y; r6 k
  80. static int ccnt = 8;& \6 U" q9 P1 c" T5 P5 i& l$ O$ O

  81. # }) f! y4 c# @& F5 D7 A
  82. module_param(acnt, int, S_IRUGO);" N- g& K& X- G! _, M
  83. module_param(bcnt, int, S_IRUGO);6 t- X6 o# }, h2 h  e8 p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( U! F  ]( R5 ?# R. C

5 d9 C; g5 ?( N0 y. E  j3 y& o# S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) t, X% N, R6 |3 Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 d6 s6 e. P2 \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& v. F& I2 |( w* n6 h5 a: O* H
3 `# H' k/ B7 O/ ]* r0 s* C+ n
4 g5 B% I2 _0 e. b1 m9 x2 ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-1 08:34 , Processed in 0.042458 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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