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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 j* e, `. e+ L0 L) ]! f
  1. [code]EDMA sample test application
    . H, w3 N" Q2 Z0 I1 r" K3 a
  2. /*" ^; g2 D9 A: C5 S" M
  3. * edma_test.c
    ' r' ]0 h: J0 j3 p/ C% w8 J1 S
  4. *1 C2 U  L6 h6 M& ^/ Q
  5. * brief  EDMA3 Test Application
    8 n2 E: {+ g. E" h& T( s% J
  6. *
    9 x2 F8 d6 D: S5 U( ~1 t
  7. *   This file contains EDMA3 Test code.
    & m& y8 J2 v/ A: R
  8. *
    $ I( j  ^# \& {8 }4 W! b/ T* F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 r9 P+ M& V* O+ R" c' T  B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& P" g4 i( q% w8 w8 Q
  11. *         TO CHANGE.3 m9 d0 g. v( J1 a
  12. *
    2 R5 F; `; w9 w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 r6 `- M+ }4 W3 b$ d: v& R
  14. *
    3 G( z2 |# @0 S* E6 P1 L, N
  15. * This program is free software; you can redistribute it and/or
    # X" D$ G; R9 X- ?1 ~' o
  16. * modify it under the terms of the GNU General Public License as
    - k/ h# T8 J! f! O
  17. * published by the Free Software Foundation version 2.
    8 j+ I7 k0 K6 F, f9 g& f
  18. *
      L$ [- P' o* w+ s) }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 j3 |/ y, [8 g4 ]  e: p
  20. * kind, whether express or implied; without even the implied warranty0 G8 L9 C  v9 {- \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- d* |' K/ M8 V
  22. * GNU General Public License for more details.
    7 U% U- }, d3 Z! X
  23. */
    ) m9 W) l0 \# y3 j1 u
  24. % ~) J) @8 e2 `( J% g* h
  25. #include <linux/module.h>+ ]! u6 u/ @. W8 \7 Z- H+ u2 r0 a
  26. #include <linux/init.h>! e: q! W9 x. {  G
  27. #include <linux/errno.h>
    & `0 b& t7 x2 |1 {2 i2 G9 O
  28. #include <linux/types.h>
    ' D+ r( P6 m) Q" C
  29. #include <linux/interrupt.h>- I: k8 l+ d2 M- u3 e  r+ j
  30. #include <asm/io.h>
    # [& p, g( Y1 e+ b
  31. #include <linux/moduleparam.h># h' R! Y% q9 Q0 p  `. j  k, p
  32. #include <linux/sysctl.h>$ H* M* @5 T- u
  33. #include <linux/mm.h>
    # |) i1 k; x( F/ `. p8 Y
  34. #include <linux/dma-mapping.h>) f  M5 }+ A  y# g# ]0 [8 e

  35. ' X# J& z7 O& N! Z  O- x' |
  36. #include <mach/memory.h>7 h8 V4 p6 Y( \4 e2 s* e& m' ~/ X; D( d
  37. #include <mach/hardware.h>
    6 o, D& ~8 S$ E2 R- k
  38. #include <mach/irqs.h>
    ' ?: \4 q; o: [
  39. #include <asm/hardware/edma.h>
    5 c" b4 }* u* J/ R
  40. , @9 K1 L' N- A$ T4 B: t7 R$ ?0 C
  41. #undef EDMA3_DEBUG
    ' n, ~) J! C, S$ J7 {5 c
  42. /*#define EDMA3_DEBUG*/
    * w9 K8 M" P+ H' J& ^6 P

  43. 3 a* {5 g7 f, S6 `
  44. #ifdef EDMA3_DEBUG  j5 G9 ?/ \2 z0 J& ~7 m8 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  {$ Y3 \9 o: w1 T2 P9 ^3 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 P! ~9 l: l) x  a9 Y" Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + q# ^. x& X: c9 T' s+ W) B2 V
  48. #else5 `# S5 u9 ~3 B2 V
  49. #define DMA_PRINTK( x... )6 S1 l0 Z: w3 Q; q
  50. #define DMA_FN_IN
    - `/ O3 H+ |5 W' \
  51. #define DMA_FN_OUT" X4 L0 _) e: ?0 y" N
  52. #endif8 C, D9 f  R8 O+ i2 a6 s6 h7 l
  53.   y8 \' P& `! f  n0 V6 K) O: v$ L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % x; {" M% x& s
  55. #define STATIC_SHIFT                32 H% A  _6 f" y0 g$ I3 V8 T# M
  56. #define TCINTEN_SHIFT               20) G5 ?. t3 B; a! x
  57. #define ITCINTEN_SHIFT              21
    / _' I% G# c+ y" n, W. j6 |1 o% S
  58. #define TCCHEN_SHIFT                220 w& B& `* B; o! t5 g! g4 q
  59. #define ITCCHEN_SHIFT               23
    ) o% U4 ^" I8 b; O/ [1 K+ M9 _

  60. ( X- c" h, m+ Y
  61. static volatile int irqraised1 = 0;% l9 J( A: [( J" X
  62. static volatile int irqraised2 = 0;9 O. U3 s3 \' G" P
  63. / n% Z6 a# f/ c: [9 V' ?  ]; T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & ?! }: o) V7 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& C& I- ]6 ?" T4 F- X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ?4 S2 l2 b+ m# S: q
  67. , b1 q# |8 a  Y
  68. dma_addr_t dmaphyssrc1 = 0;  i& v9 L# i, H5 {3 E5 V3 P7 w8 `
  69. dma_addr_t dmaphyssrc2 = 0;/ U8 B8 G3 v8 H9 u/ P
  70. dma_addr_t dmaphysdest1 = 0;
    ) T; N$ V( T, R8 [
  71. dma_addr_t dmaphysdest2 = 0;  _# Z3 q9 `/ P) P$ r

  72. 8 g  u: k) Z' L, }7 e- C
  73. char *dmabufsrc1 = NULL;6 s1 l# X* ?- p) }& u/ y) q
  74. char *dmabufsrc2 = NULL;
    ( r: Y# u$ o% X5 C0 r
  75. char *dmabufdest1 = NULL;9 Z9 E; E, X$ s8 O
  76. char *dmabufdest2 = NULL;' `3 ]$ A+ j5 M" N  p1 h

  77. ) G: o- P) Q5 ~7 M
  78. static int acnt = 512;
    9 k  ?2 i, c. n0 a
  79. static int bcnt = 8;) a$ l. C% @  y3 @
  80. static int ccnt = 8;
    # w4 X9 ~7 y8 Z/ K
  81. / |: b8 H) Y7 f  k3 _" o& I- \' F
  82. module_param(acnt, int, S_IRUGO);9 ?6 F2 _; C1 Y! U; w
  83. module_param(bcnt, int, S_IRUGO);
    ; f- T4 z6 @4 W: k  I' t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% p% I$ o; D/ H7 b0 S* z" Y' ?+ P1 f' X( z# ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; B1 m( p& D0 V3 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# `* j) ~- s0 Y9 a
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ I9 w$ h0 }" `1 B0 N* y
1 u' z2 I  ]& c
; w) Y; `0 P$ W6 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-13 23:11 , Processed in 0.036810 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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