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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; _" [" g: u5 c" t9 o0 u
  1. [code]EDMA sample test application
    7 B3 x( m! p4 I/ {% f
  2. /*( d# k- Z( D1 r) n  U! I" F
  3. * edma_test.c' `, ?4 x( k; X& L4 H; c
  4. *4 W: M3 Y3 Z& ~& E; D
  5. * brief  EDMA3 Test Application( s0 e. U' P' Q* C5 u
  6. *2 f& T" e# b, O% {6 D) U+ {
  7. *   This file contains EDMA3 Test code.
    * E' h/ f* }$ T4 s
  8. *
    " B# H0 C+ @; A( i& D- P- F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - \$ H+ a4 A7 ?3 b1 V) b6 H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 y! Y+ _# E7 c3 P
  11. *         TO CHANGE.6 q/ N& f/ P( z0 [9 ^& q: p; [
  12. *
    ; R8 o  _; V$ r4 w' X  a& l# l9 R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% E3 e- Q. t/ F! y) Z4 R
  14. *
    7 o6 V8 S) z- D2 q% Y# R
  15. * This program is free software; you can redistribute it and/or( j( V0 m3 K+ p4 \3 m: ?
  16. * modify it under the terms of the GNU General Public License as
    + n3 o- Q# C) Q- w6 {' v; i' A) Z
  17. * published by the Free Software Foundation version 2.
    % N; j. J, x1 E; r
  18. *
    & U7 z* {4 Z( ]! L6 @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 ~6 B9 L  y  @" T% }
  20. * kind, whether express or implied; without even the implied warranty
    5 s' W) ]0 I; }1 v5 N4 `" T' Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ o6 V# }) U- e; S
  22. * GNU General Public License for more details.8 S! o" S/ Y) k4 j, T
  23. */
    - l( j$ A- k- N: Z4 }% B
  24. 3 n) O+ N. h- U9 m8 c/ e$ E
  25. #include <linux/module.h>
    7 a! }8 g! m+ H3 @" I
  26. #include <linux/init.h>0 X9 d2 F9 _5 X
  27. #include <linux/errno.h>
    # N1 m. U9 f- d, V
  28. #include <linux/types.h>
    1 t4 L; b# C+ w1 S) B( b" g
  29. #include <linux/interrupt.h>9 D& Q1 t- `1 L( Q0 U7 G' A
  30. #include <asm/io.h>
    & A& ~+ w" g3 v2 [  i, O2 P
  31. #include <linux/moduleparam.h>, |: G; _6 r9 ?( Q" q* r1 `
  32. #include <linux/sysctl.h>$ g: k: w" O! A4 u1 r
  33. #include <linux/mm.h>
    4 D, w1 |3 F8 v6 C
  34. #include <linux/dma-mapping.h>
    8 x6 x# L: e2 F1 l  y: X
  35. + R; V! G1 M/ y& u% p1 A
  36. #include <mach/memory.h>( H; R+ J) _9 U
  37. #include <mach/hardware.h>
    1 R% {( y1 |# o6 f; `" l( J: Y& v
  38. #include <mach/irqs.h>
    ( j5 G$ q  o7 K8 Z! n
  39. #include <asm/hardware/edma.h>
    7 c+ [+ u! a! `7 N- ?& l. T1 t

  40. % {6 V: L+ ?$ U
  41. #undef EDMA3_DEBUG
    , k: |5 _5 f3 Q, D+ I1 B- `3 t/ ]
  42. /*#define EDMA3_DEBUG*/
    . ^+ v/ m0 H  q0 W

  43. ' n4 B) d9 I3 _. Z' D" a0 V
  44. #ifdef EDMA3_DEBUG
    ( r: o2 s* r# j2 q" U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 F* P8 `; `0 Z0 \- [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 Z( T: W# Y+ ^0 B5 ~; W& F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 O, e8 `7 d' p/ z2 N4 V
  48. #else
    ( H$ x- K+ S6 B! }
  49. #define DMA_PRINTK( x... )
    ) R; f- ?* X7 J6 n9 |0 c
  50. #define DMA_FN_IN: e% \+ B7 w% g6 ]
  51. #define DMA_FN_OUT* x7 K$ F% h* `; a* Z) g$ F
  52. #endif3 I# q9 _* l8 Q- I: B
  53. - i9 y! h7 {/ H# ~9 Y2 @' x: Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + ~7 X) t1 f. j8 {, L( C
  55. #define STATIC_SHIFT                3  u: c, W' I; B. j3 ~
  56. #define TCINTEN_SHIFT               20
    " ]6 ]' W; r3 Y) z( J4 ]2 q) F* E
  57. #define ITCINTEN_SHIFT              21
    7 N. t7 V$ N6 w6 x) }" Z
  58. #define TCCHEN_SHIFT                22
    6 M- l2 ]  L4 S! j# ?+ w
  59. #define ITCCHEN_SHIFT               23
    % I: a+ U/ ]2 z. ^) T/ |
  60. ; n  U  m$ y' p
  61. static volatile int irqraised1 = 0;' |5 ?# f) O" W' |  i
  62. static volatile int irqraised2 = 0;
    / [5 @5 ^$ I4 C- k5 B" B! t/ W
  63. . J+ a" A# [7 |- [( [, T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 K" L$ a* U% n8 p& v, c0 r3 e) |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% T; r: @9 ^2 x- G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 Z/ j2 C) ]) X, X' F' o, E: x" t& Z

  67. 0 p4 u3 F+ b, m7 Q6 H$ x: `# D
  68. dma_addr_t dmaphyssrc1 = 0;
      O3 Z3 N3 h1 o. L: @3 `
  69. dma_addr_t dmaphyssrc2 = 0;
    : [4 W3 {- C# z* ~! A8 Z
  70. dma_addr_t dmaphysdest1 = 0;
    - z0 _; A5 Z4 m- G9 i. `
  71. dma_addr_t dmaphysdest2 = 0;4 O! B# k6 I  O& {

  72. & s( R2 ?/ g" n( r" k' r. W
  73. char *dmabufsrc1 = NULL;: ]+ P" P+ X7 g1 s+ u! A& H
  74. char *dmabufsrc2 = NULL;8 u" A! o7 Q& f+ x
  75. char *dmabufdest1 = NULL;' `* ^" C+ [! C8 Q
  76. char *dmabufdest2 = NULL;) l6 T  r) p) i# b( o

  77. 6 j* x( ~7 v& m8 N; y) U7 T
  78. static int acnt = 512;
    * u' R9 A( P! m& h6 y8 J
  79. static int bcnt = 8;
    ' {5 K. L2 c! D2 F9 T3 E
  80. static int ccnt = 8;( K: L! H$ b8 |

  81. 2 U( ]. j0 T( c5 G9 l* J: [  Q
  82. module_param(acnt, int, S_IRUGO);- O+ \) {- m5 `: |) \. \
  83. module_param(bcnt, int, S_IRUGO);- U* J5 a/ F: \3 t( {- j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' F+ f/ R5 L* d  U' B8 d
! \6 K9 w* j/ a0 G9 b5 {# V+ \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 Y9 m5 R3 h1 t& t8 s) A/ C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 o5 G( Y, |! |, L( e2 s6 U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& n' s3 w5 S; K' P
* r8 a# U0 C# M: a& V
) \3 J/ f/ _4 K2 d+ _, [7 J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-2 22:12 , Processed in 0.043704 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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