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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 }! F8 i! i6 @8 L" B- {* _9 `
  1. [code]EDMA sample test application4 ]6 j! D+ Q6 K2 u
  2. /*
    ) r% r& f/ Z$ L) @4 v! @$ p+ j
  3. * edma_test.c
    : R% y7 e+ \5 T' {, |) h
  4. *
    ) p2 P* H- r* X2 A6 _# ~
  5. * brief  EDMA3 Test Application
    4 X6 ~8 z6 e, o* B
  6. *
    " X( _- I5 V; u% b6 o
  7. *   This file contains EDMA3 Test code.. M" G8 o7 F  y! D3 P( T4 h
  8. *
    ; ~+ t7 h  G7 W" h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 o" H1 s5 N/ P* C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . L3 E) O1 \4 o
  11. *         TO CHANGE.* Z2 R# o" V0 H8 l# M
  12. *
    : G% n2 Q2 W9 ]) p) k! t' x+ ~$ }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % t  @: w8 F! f* M
  14. *
    3 b9 m0 d6 v0 \$ F6 J
  15. * This program is free software; you can redistribute it and/or
    . u& {2 F3 T0 R; @$ j% k
  16. * modify it under the terms of the GNU General Public License as+ [5 M9 D3 Z% J5 K' k/ W  ^
  17. * published by the Free Software Foundation version 2.* r1 U/ U3 Z) w, |) l3 O
  18. *
    ' [% _5 r5 |. q" u% j4 Y  ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 I# A( w- J4 @6 n* K1 o  G
  20. * kind, whether express or implied; without even the implied warranty& j& M3 c8 U- S6 a/ y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! N4 T( Q) i3 l6 ~! F
  22. * GNU General Public License for more details.
    : f1 a# d) w: a- c" w7 U& R
  23. */" j+ Y: y) W" X# J
  24. : G7 n- y+ z( o; v' J
  25. #include <linux/module.h>
    % s  y6 w" R( R! G6 f
  26. #include <linux/init.h>
    % J# p" b2 t( Y( O1 |
  27. #include <linux/errno.h>
    5 G( }8 o, A& P* C  _. ~' j" Q
  28. #include <linux/types.h>
    " N& H4 d& O! _  z! `: X# l: b
  29. #include <linux/interrupt.h>; I& k: M1 X* m- [1 s: E% {
  30. #include <asm/io.h>
    " k+ Q* j/ ?/ ?1 W: r
  31. #include <linux/moduleparam.h>, l& k" w! ?, ^1 {: K* Q
  32. #include <linux/sysctl.h>
    + A' P2 U4 Q+ `# w$ a5 S
  33. #include <linux/mm.h>
      a, \5 J3 Q" L- N0 c# y' [& C, O
  34. #include <linux/dma-mapping.h>: a/ I6 r4 Y  r0 `3 C+ Q, l
  35. 6 O' A+ q; e, E& V8 B  |1 B6 r- B% Y
  36. #include <mach/memory.h>: ]; d  B8 v0 R+ k' ^' e; ]
  37. #include <mach/hardware.h>3 }* s& y, \( i5 |1 f# e
  38. #include <mach/irqs.h>
    9 ?; Z2 n) W2 f; l) N+ l" k8 F; v
  39. #include <asm/hardware/edma.h>
    2 a, r" Q. D* O: }/ a

  40. 4 l4 k2 L! S* X6 {% s9 }
  41. #undef EDMA3_DEBUG
    . I0 c& P6 {5 m$ c
  42. /*#define EDMA3_DEBUG*/0 \3 |' D: R0 a' S, p

  43. 1 z9 P9 U8 h- r2 X. @5 _/ b# V
  44. #ifdef EDMA3_DEBUG
    ! p9 M4 `$ z9 O" J6 V7 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): P! u" m: J2 Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) I" y# k6 [4 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # x) X2 w3 P% Y: Y
  48. #else
    $ y. r7 ^& w4 {
  49. #define DMA_PRINTK( x... )
    - q6 |1 E9 v+ f' S
  50. #define DMA_FN_IN% O& H: w3 F( w% C/ `
  51. #define DMA_FN_OUT
    , u0 M; d' W5 J, w# J
  52. #endif
    6 }" Z4 C. ?" f" F
  53. ) b$ e% S$ r' i7 \4 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# z, Z) f9 l2 r+ W
  55. #define STATIC_SHIFT                3
    ; ?5 P( ?# X% B& _# s
  56. #define TCINTEN_SHIFT               20* F. O6 u2 k' B
  57. #define ITCINTEN_SHIFT              21
    5 `# E# d# [! K7 w+ g+ d! E% h
  58. #define TCCHEN_SHIFT                22
      U! D. p& P1 m
  59. #define ITCCHEN_SHIFT               23
    % V4 \! N4 N; z+ F3 G7 ^/ i0 P
  60. $ K4 k, s! B5 a7 v# U% X2 Z
  61. static volatile int irqraised1 = 0;& c2 z$ |/ @& W- K  u# H
  62. static volatile int irqraised2 = 0;
    $ X; R, K( Z( R8 t! T- t( a' Y

  63. 1 T3 ?2 Y: n7 a1 N0 k$ @3 L: U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - _* V7 x' d) Q, B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - V% x0 y" m! b8 f/ P( c5 s" R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 c, z/ a3 D7 i# S' R, v
  67. 8 A$ z4 f- Y9 C* J
  68. dma_addr_t dmaphyssrc1 = 0;1 F- l/ a8 T% ^/ u4 L' F+ \. D
  69. dma_addr_t dmaphyssrc2 = 0;
    & Z1 x  J0 ^7 r' |/ O! f4 l
  70. dma_addr_t dmaphysdest1 = 0;
    5 L1 q: R; m8 i# h+ }0 L
  71. dma_addr_t dmaphysdest2 = 0;
    4 D" h" N) c7 ~+ H; B6 h1 _7 I  h. f

  72. $ U0 E& l! R4 ]& T
  73. char *dmabufsrc1 = NULL;
    ( r7 A4 F) X5 ^& B8 ^+ b4 _5 A$ _
  74. char *dmabufsrc2 = NULL;' f6 k+ K# C* N) r
  75. char *dmabufdest1 = NULL;
    8 E; t4 |& ~0 h6 n
  76. char *dmabufdest2 = NULL;
    5 |7 Z; q% `) {- k" q

  77. # v) D% }  ]* s% l1 {
  78. static int acnt = 512;. l4 a) N! X1 Z
  79. static int bcnt = 8;
    ) v$ t3 b$ b$ |' F! Y4 V0 T
  80. static int ccnt = 8;" b3 J- {% ]0 h* n/ s
  81. 2 |$ t# V/ u. k: N3 g0 z7 I7 j
  82. module_param(acnt, int, S_IRUGO);! s/ g0 t! r. l* T3 g1 z* S7 s
  83. module_param(bcnt, int, S_IRUGO);
    + O5 i! R/ Z& L2 T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 R; @2 t/ K2 e5 w' z, h8 R9 k4 q" S9 m3 b0 Y& R6 l3 n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; _- z4 |2 a7 |6 X. o. q. p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 [* s6 ?' |5 w/ E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 G! R7 Q, G2 I! ]
8 H4 H% [9 I' a4 w8 w" _

, d: x0 [* p( S; w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-26 22:23 , Processed in 0.040122 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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