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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( p1 ~( U! Y2 t5 u$ O; ~
  1. [code]EDMA sample test application" I. [* G* P$ [( O6 |* v
  2. /*$ U$ u  X: U; p6 H6 k
  3. * edma_test.c& j" u) N3 i" X% H
  4. *
    ' G9 f1 E4 P! S: L! m% |! n
  5. * brief  EDMA3 Test Application
    $ P( Z2 R& b& J0 T$ H+ j* ~
  6. *
    : F7 X3 h$ }; @$ y, C9 q+ a4 l" ]
  7. *   This file contains EDMA3 Test code.
      _  M( u1 s+ J, D3 J
  8. *: A, p; d! j( \7 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 Z! X$ J8 W. `: Z% Q4 P3 r. {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ _  X6 ]0 n. l1 \* P; r! c1 g
  11. *         TO CHANGE.  U/ V; Z) Q( `7 M5 A. w% t
  12. *
    2 `1 C, E- }2 y7 s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % o; h' b- [6 e! h
  14. *
    $ P8 h8 q) R" H7 u" u3 d& x; G' B- l
  15. * This program is free software; you can redistribute it and/or
    # J; l2 b' m& N8 S
  16. * modify it under the terms of the GNU General Public License as- b4 y, v  h. s$ j* v9 H; b
  17. * published by the Free Software Foundation version 2.$ j: }% A1 S: W3 t" ]8 G" \
  18. *1 O/ Y% Q3 T# Q0 J* t2 H+ H' y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " {0 e2 M" ~' U) r0 X
  20. * kind, whether express or implied; without even the implied warranty) Z6 D4 {, P. m1 ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 u" U) a, b9 L9 `8 S9 R
  22. * GNU General Public License for more details.1 v# E* e5 n$ |
  23. *// l  D% F- k: j1 ]$ Q$ z
  24. 4 x6 Z. h1 M. F
  25. #include <linux/module.h>
    1 e4 f4 c( s3 r/ d  q
  26. #include <linux/init.h>
    % X3 N$ S% S2 P4 o4 ]
  27. #include <linux/errno.h>' H9 _5 A; S- k) d. P  v0 G) L
  28. #include <linux/types.h>5 d: o/ R3 k5 U9 O3 J( S2 @' [3 H
  29. #include <linux/interrupt.h>6 L& G- `# S$ @1 [7 e# Y  v- e
  30. #include <asm/io.h>, N- n& I2 L7 N4 c. \! [+ I
  31. #include <linux/moduleparam.h>
    # m% p: K" ~4 U& q- @, i  j
  32. #include <linux/sysctl.h>/ ]) a& `; ?. ]! |( Q
  33. #include <linux/mm.h>
    " A1 B4 T5 Y; O" b3 d
  34. #include <linux/dma-mapping.h>7 n% r, A! s0 U' H- @( N6 A
  35. % ^9 m# |9 N, U" z  ], C
  36. #include <mach/memory.h>
    % w, |" {- E% t1 l6 P& c) y1 R
  37. #include <mach/hardware.h>
    ; E$ W& ?. p( k
  38. #include <mach/irqs.h>4 A  y5 n& `  R2 O
  39. #include <asm/hardware/edma.h>& a+ X$ n2 \  y0 G0 f& K
  40. ; E$ i  N; p  |, o% J8 T
  41. #undef EDMA3_DEBUG
    + J+ \4 r9 K  Z0 t' q+ @
  42. /*#define EDMA3_DEBUG*/
    , x/ c1 }: X7 w
  43. ; }3 ]! ]9 ^) d  ]# s  C
  44. #ifdef EDMA3_DEBUG* P& i3 n8 g8 k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ k$ I: y* o. ^% r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). t" H0 L( t& |2 V/ g' U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) E' T, t4 c% }* m
  48. #else
    3 P( s1 }( C. m" |) E" J0 n
  49. #define DMA_PRINTK( x... )! `" J, J% v$ e: l
  50. #define DMA_FN_IN
    . ]% s) v$ R+ L( v
  51. #define DMA_FN_OUT; w3 n* n! n. d) Z( K* T( ?
  52. #endif
    ! K5 z+ i, c- |7 \8 p8 r; |
  53. $ ?5 y, K; T8 U4 R0 v' W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 a$ L; K2 J* }7 S2 c- [
  55. #define STATIC_SHIFT                3- s0 Y- y; q3 t5 l. C- M8 q) _
  56. #define TCINTEN_SHIFT               206 V1 S* w' k7 u7 ?/ q  X# H
  57. #define ITCINTEN_SHIFT              219 V4 h, c1 |! e, F: t: x" Q# Y
  58. #define TCCHEN_SHIFT                22
    0 E7 L5 ]! D, _7 x( e
  59. #define ITCCHEN_SHIFT               23
    4 m5 H* ]9 ^2 i3 ~9 C7 j$ G. z

  60. & d" W1 M$ x' `$ H9 d" G: x9 T
  61. static volatile int irqraised1 = 0;
    ( t" `: v5 {" X
  62. static volatile int irqraised2 = 0;
    , k$ J3 M) {# F, x. u5 ~

  63. & B) D' d  y4 Q1 N0 e& s8 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ?2 O4 H" D1 z" o* G# ^. h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 {; o9 M4 c; O. L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      {2 A3 b* A7 }, l# t  o+ o

  67. 2 ?. x7 \4 K2 T" A1 I( x& }1 x
  68. dma_addr_t dmaphyssrc1 = 0;# E% A, ^8 M. d
  69. dma_addr_t dmaphyssrc2 = 0;
    4 o3 c4 Y! S9 W' ^0 D0 P, U$ b
  70. dma_addr_t dmaphysdest1 = 0;* ~- E! m6 A. H0 K5 S6 t
  71. dma_addr_t dmaphysdest2 = 0;
    : a2 x  a! e1 f. ]2 H2 W! Y- \

  72. . w! L7 Q( u& K* q
  73. char *dmabufsrc1 = NULL;
    3 y. }7 r- F4 z. J9 j" Z
  74. char *dmabufsrc2 = NULL;
    : R1 {4 A8 x* T1 @
  75. char *dmabufdest1 = NULL;: Z+ j2 Q5 x$ Y6 z
  76. char *dmabufdest2 = NULL;, }0 O5 w2 f: V9 M+ J
  77. 1 ~# x7 G6 s0 E# c( z3 b
  78. static int acnt = 512;
    1 |: M; U* G0 m# K, E
  79. static int bcnt = 8;
    ) [  ]) H4 ~& a: W1 D
  80. static int ccnt = 8;. d8 o7 v2 N: R2 P
  81. ' p  s" S  d: V( Y
  82. module_param(acnt, int, S_IRUGO);; t! t; i# l& {) G" c
  83. module_param(bcnt, int, S_IRUGO);
    $ t( q; q% \: e/ `) L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% {1 [9 k; Z5 _  c& |  z5 N) V; y' Q2 r! J' m, C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& ?3 P# ?' S* z" P6 S" y, e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 A, L3 G+ G: {2 Y  G/ v+ _" x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 e( w" K$ o. \( J

& @& Y' I, G9 X! a6 F
' W+ A( p# S! Q% L' X+ S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 11:48 , Processed in 0.041249 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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