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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 i1 J. A( O* ]+ [* p' l) ?
  1. [code]EDMA sample test application7 s3 T( m, J. V( P' q
  2. /*
    3 ]. j) I/ {" C4 J3 q4 U
  3. * edma_test.c7 B, d; [- B% C" R& S7 f
  4. *
    % [, z3 g( j: D7 l) O) I& J
  5. * brief  EDMA3 Test Application
    4 N. F  N- v; Z6 }9 y
  6. *8 k% n1 Y# D) B3 t2 [
  7. *   This file contains EDMA3 Test code.
    ; `' ]4 U# g) X5 b& U# a+ T( v
  8. *; _, w5 M2 {3 G* k+ ~) b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 b6 [. f+ p3 B) G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! e8 W8 M1 P) o) t7 ~( j2 v& G
  11. *         TO CHANGE.5 X, e# ]1 z; t- J  z* l. a! ?
  12. *9 k+ F% f- B2 Q. I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 c& a, T) N# Q: j
  14. *8 R  o  Q( x3 i$ J. ]* _  Y( P) L
  15. * This program is free software; you can redistribute it and/or3 [6 O$ |5 r0 \: y
  16. * modify it under the terms of the GNU General Public License as( p, p9 g0 y; T( O! g
  17. * published by the Free Software Foundation version 2.
    2 d8 e* `2 x% w% A) n/ s
  18. *' O/ E( E+ b, l1 H- g3 i3 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 @7 U0 T% E" e
  20. * kind, whether express or implied; without even the implied warranty# V3 p9 b3 z. f4 H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 a' z9 l% k5 O: N2 c1 o! w
  22. * GNU General Public License for more details.
    7 Z+ v- w* [* D7 F2 l- k
  23. */1 j2 R* M  L- J
  24. * A- S# n/ N- W% T) T1 \
  25. #include <linux/module.h>2 l% ^3 z7 d" g8 z2 i) |1 M
  26. #include <linux/init.h># Z& l$ n( Z1 W* n
  27. #include <linux/errno.h>" R9 e/ Z! T& A. n- n! T
  28. #include <linux/types.h>
    1 k4 C% d+ P; i+ o% \2 B8 w5 {
  29. #include <linux/interrupt.h>
    $ d0 Z9 Q# A% t- K8 t
  30. #include <asm/io.h>( W$ t6 M6 E2 `2 h( i9 U
  31. #include <linux/moduleparam.h>
    4 t1 L0 A; |4 g; P& T* y* m
  32. #include <linux/sysctl.h>5 H2 A# @$ ]2 G: j
  33. #include <linux/mm.h>, n( n4 ]  s; S, C9 y
  34. #include <linux/dma-mapping.h>/ r: w; |1 P  `( Z

  35. ' I' M* ~; o/ j1 B# M4 U
  36. #include <mach/memory.h>6 s) `# u2 V. U; N4 ]
  37. #include <mach/hardware.h>- S/ X5 ?+ M+ c! N
  38. #include <mach/irqs.h>5 P! ~$ B! O; x2 E! {0 c
  39. #include <asm/hardware/edma.h>( B3 Q2 @9 @$ e  b5 p; K6 {: {
  40. ) d9 u) O9 K. @. {/ ]9 D2 [
  41. #undef EDMA3_DEBUG" t* u4 ]3 D5 A; }4 {
  42. /*#define EDMA3_DEBUG*/
    . q7 R9 A" b# H/ ?
  43. $ {: c& ?" s1 m- R! {% m# q" X; i
  44. #ifdef EDMA3_DEBUG
    ! C) f* Q9 t  h! [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), b8 X0 }2 N) m3 P& [+ I+ {5 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  }: X; W9 E1 h) [) `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & l9 g5 t9 y5 R) x; Z+ U- t
  48. #else
    2 W* W! P# x1 R' y2 P
  49. #define DMA_PRINTK( x... ): K2 |# @: Q: Q+ M; W
  50. #define DMA_FN_IN
    * P2 h. \6 \$ X; \+ j" d" Z
  51. #define DMA_FN_OUT5 }: @' e0 \6 K) A6 _
  52. #endif
    - B$ H& U# c- G' b

  53. ; i5 P% @! G* c, `& {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 g& X7 F) s( n; F4 c
  55. #define STATIC_SHIFT                3
    / ], A1 x! ~  ~; x0 g
  56. #define TCINTEN_SHIFT               20& c+ R+ S6 ~5 @- k. |3 T  K, q
  57. #define ITCINTEN_SHIFT              21# i2 s; P# O8 K3 @* ]& A
  58. #define TCCHEN_SHIFT                224 a7 C/ [1 Y) z* y  H( g3 P
  59. #define ITCCHEN_SHIFT               23* J1 t/ B; Y' J
  60. 1 J5 Y; K+ ]! \$ T$ ^$ y
  61. static volatile int irqraised1 = 0;
    $ |  L+ S4 ]( k( g# l5 G
  62. static volatile int irqraised2 = 0;7 Z: p1 X; S+ }
  63. % v. Q" B& I9 y* H, c2 R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* [2 t: Y9 e' J7 t& e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) V9 y  z" k5 D3 E, j. H& X' C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / O+ ?9 H4 p  Z$ I0 G( _: \4 R
  67. ! q$ W4 a9 i- W! i
  68. dma_addr_t dmaphyssrc1 = 0;# L: E1 P' i# F; E$ S
  69. dma_addr_t dmaphyssrc2 = 0;+ R( _& k  f; h8 q1 f
  70. dma_addr_t dmaphysdest1 = 0;  o" a% D/ X. E+ }
  71. dma_addr_t dmaphysdest2 = 0;, ^8 r5 O" L  R) U( K& H5 I
  72. 2 e1 K5 h( \( v& m! ~
  73. char *dmabufsrc1 = NULL;( g( A; N, C6 D$ g( ]
  74. char *dmabufsrc2 = NULL;) S) \7 Y  W& z) Y& L& ^0 F; v
  75. char *dmabufdest1 = NULL;& I. B; Z9 z& c! {2 Z
  76. char *dmabufdest2 = NULL;1 Y) o* S( K( Z% Y# a( |

  77. ' o' N7 X4 M0 [  b
  78. static int acnt = 512;
    ) H' ?  a9 `( R! h. w! W4 A. C
  79. static int bcnt = 8;
    1 v, u0 e' a* o+ a/ S0 B% _  u2 U
  80. static int ccnt = 8;0 }( ?; r9 T) R8 a2 k8 \
  81. 0 N+ p4 B8 E% R
  82. module_param(acnt, int, S_IRUGO);4 S* k; o7 q- U
  83. module_param(bcnt, int, S_IRUGO);
    2 F( A; a9 n' s: W) R' I& m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! W) s0 y* G. I' R) d' ]$ A) N9 j6 {) b
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( f; t8 Z- h! O, {! U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  G/ U  M3 B) b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( q, V2 ^; }/ j- \" ^! v7 \+ m' M

% J, b! j  O# `
" ^/ Z/ Z6 ]2 C0 o+ _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-15 20:11 , Processed in 0.038262 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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