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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' j; m$ b  M# F( a, d! y
  1. [code]EDMA sample test application9 W$ [* J/ h9 c; ?
  2. /*$ E/ P& w6 P. q( Y
  3. * edma_test.c! y1 n' J2 d3 y7 G
  4. *
    ) P8 m) c$ z) H5 t% J- f9 q( k* m
  5. * brief  EDMA3 Test Application
    . Y* H- G" B2 V6 P* B- \1 r( z0 }
  6. *; A! m  _! M% A4 `+ L1 Z( Y2 W
  7. *   This file contains EDMA3 Test code.
    & \% L5 y' A4 c! Y- @; t' N1 H
  8. *
    2 ^; a% ?3 @; }1 v, I" g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ z, v* Q6 S  E# F& w  N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 ^( C: i1 _! |7 g! ]
  11. *         TO CHANGE.
    ) e* L- X7 U1 n! e+ @
  12. *
    : m+ N2 n* g; k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! o( |+ v# S/ {* l/ o% T7 ~- C
  14. *
    & a( f/ o9 d0 K% {
  15. * This program is free software; you can redistribute it and/or. j6 [- e" N+ N- ~3 X: F( `4 @5 [
  16. * modify it under the terms of the GNU General Public License as, \) `( i( D9 W8 ~9 w# _3 n! n' ~
  17. * published by the Free Software Foundation version 2.0 S9 l( U& f2 F8 x0 i( `; A$ B
  18. *" b+ v; w+ k" K4 [+ i" s2 n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- p; `2 y# B/ P6 o0 j7 Y, i1 Q# H) o
  20. * kind, whether express or implied; without even the implied warranty
    ( @" \, X  \* M7 s! h( n6 p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & |! ?5 [0 N5 J4 I+ S+ Y2 \  F
  22. * GNU General Public License for more details.
    2 [3 z% B$ G* W' J
  23. */4 C$ ?" Y$ R; o4 c7 o/ N/ }
  24. 1 U# {) Z( D- }
  25. #include <linux/module.h>
    / Q3 U+ h! Z4 u5 a" M2 f! W8 s
  26. #include <linux/init.h>
    4 @$ l: z. W( x: [  \: ?
  27. #include <linux/errno.h>
    6 q$ I5 `) T# n9 F' _& v  x
  28. #include <linux/types.h>+ l/ B* g3 q2 M  G$ s: ]7 f( s
  29. #include <linux/interrupt.h>
    3 m, A: {% j7 ~' u
  30. #include <asm/io.h>+ i8 r  g/ l  F$ B& D4 y* D  Z. @
  31. #include <linux/moduleparam.h>
    ' J1 _  p& x) H% j: ]
  32. #include <linux/sysctl.h>& w$ f& j% O' q4 y
  33. #include <linux/mm.h>: ~2 v& G3 Z; g- R& n" B/ U
  34. #include <linux/dma-mapping.h>6 z; v7 ^! _" x

  35. / x+ ~5 e# v0 U  F! G6 \0 r2 i
  36. #include <mach/memory.h>
    3 {6 s% u8 p' ^% j0 o" q$ }
  37. #include <mach/hardware.h>
    5 ?( f. q% d4 Y) a0 g. d
  38. #include <mach/irqs.h>$ g. k3 R5 E" c0 i3 j, F  r
  39. #include <asm/hardware/edma.h>
    + r  ~* ]# @8 l- j; V9 K1 g* j# p
  40. ( `6 K9 L% a% v0 s9 a+ ^6 Q! K! r7 y! |
  41. #undef EDMA3_DEBUG/ H; p$ q4 D5 F$ c2 R1 S+ J/ g! I
  42. /*#define EDMA3_DEBUG*/
    7 k' {& x( R' J0 E5 ]' K* V

  43. ; d& j9 g5 ]$ i
  44. #ifdef EDMA3_DEBUG: {/ i' `; @  y4 M: K( J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) [( G: b$ k; F6 N5 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& L- C1 w: K/ h  }# ]2 s- r* I/ {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 ?. r" ]3 e' K6 B+ Y6 Z7 Z" k
  48. #else
    ; l" q6 T/ U4 X; \  \3 O8 ~
  49. #define DMA_PRINTK( x... )- e8 w7 e' M# d" \. n! l4 \" @
  50. #define DMA_FN_IN" w6 f2 C- x% D
  51. #define DMA_FN_OUT
    $ C3 Q7 X( V" w9 f
  52. #endif
    6 D; w0 A$ j  n/ L& Z$ v) I* f0 a

  53. * G9 \) z  f# ^4 ?2 ^2 E# q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 o4 J6 q3 W; w  H6 Q
  55. #define STATIC_SHIFT                30 q8 X; t9 [7 X  C+ T# u4 j% M* b
  56. #define TCINTEN_SHIFT               20+ k7 x8 t0 X) _
  57. #define ITCINTEN_SHIFT              21
    * a; Y/ k$ X7 }- W2 _% }# k
  58. #define TCCHEN_SHIFT                22
    / d9 v7 ^6 w3 y) V/ [
  59. #define ITCCHEN_SHIFT               23
    3 q- C0 A1 x0 ?/ j" T$ C5 x9 F( d
  60. 1 o0 T# f+ X7 S
  61. static volatile int irqraised1 = 0;
    7 S' A$ k, i  X) }+ c
  62. static volatile int irqraised2 = 0;. P/ n% w% `" K3 j' O3 M, w7 `

  63. % J) W% g$ }. Y" w1 ^0 t% l; n$ X) Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Q, c, Y4 x) v, S! P/ C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: [# O& Q. c6 R) Z1 ~4 x" R4 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * y7 |$ y7 a, H$ s: f3 i! W- S9 s) i

  67. 6 H- [4 T, _; w4 |$ S2 Q
  68. dma_addr_t dmaphyssrc1 = 0;1 P% t" M" h+ g7 g9 f
  69. dma_addr_t dmaphyssrc2 = 0;
    2 h% D8 Y2 [. _0 E
  70. dma_addr_t dmaphysdest1 = 0;
    ' Y$ X( }; \$ o, n7 [0 b% A# N
  71. dma_addr_t dmaphysdest2 = 0;
    7 x! P8 I! j; B% E& t# t( i

  72. . v/ i. A) @6 \2 J: z
  73. char *dmabufsrc1 = NULL;
    % ]; v0 p# S1 \: z! v: g6 V
  74. char *dmabufsrc2 = NULL;
    ) ~/ }' J7 v& |2 P8 l
  75. char *dmabufdest1 = NULL;* x2 N9 ?( |0 x3 F$ s- l
  76. char *dmabufdest2 = NULL;4 l1 I& W  w8 Q! ?1 }3 @. P
  77. * u5 c" f* \% ^8 O
  78. static int acnt = 512;9 Q4 E5 O) f) N9 d6 c3 v$ e1 m
  79. static int bcnt = 8;. z! a" r/ a3 r1 p6 |0 X
  80. static int ccnt = 8;8 I$ Q4 I' D% C. p) R2 u

  81. . g; T4 \9 y' c; G
  82. module_param(acnt, int, S_IRUGO);+ `) k( K2 `0 ]% b3 A1 l8 Q8 v
  83. module_param(bcnt, int, S_IRUGO);
    * `- M! |% e! Q0 {2 o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 X, `; P; _' [1 }- T) Y
# ]* S( r# e) ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% K! o3 y9 k7 S% {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- H& d1 {, n2 a  y' s( v& [     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 l" C* L7 v) ]. b7 u, [

- H& ?1 e! F9 t0 s4 `" p0 Y6 i3 l. Z+ _. i" H$ ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 08:27 , Processed in 0.040316 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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