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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 R8 A/ i! }  {+ K
  1. [code]EDMA sample test application
    8 s& }; O& M- D1 ?( W. b9 H
  2. /*
    2 i3 c  s$ C4 W* j" v) e
  3. * edma_test.c) y4 c' {& z! M4 P' P1 i1 H$ z. l5 ~
  4. *
    * N! P* g7 j/ M# v9 x9 s# S
  5. * brief  EDMA3 Test Application! U3 w& g& ~( R: z6 X
  6. *: q  w- T8 ~7 L6 t/ g
  7. *   This file contains EDMA3 Test code.( e0 \9 _2 u9 K( g
  8. */ S9 b. u! ]; R1 U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 k; J: @$ l# P8 D/ k% v8 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ z+ e) c: p/ V  T! u" ?, k) }
  11. *         TO CHANGE.* i0 t  d+ g* Z6 O: G8 w: k
  12. *, c. D5 W% l6 t0 b! Y/ R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# R1 b. r' t: i+ d, {+ j' i
  14. *: d+ Q5 W$ [$ E, g  A0 i
  15. * This program is free software; you can redistribute it and/or8 g7 v# _( q+ N2 G0 Q) P) {, h
  16. * modify it under the terms of the GNU General Public License as. `; K$ \) q. \0 K4 G, B
  17. * published by the Free Software Foundation version 2.
    8 h8 V8 {: h. R/ t3 d
  18. *! }; D5 }, E3 ]. `6 `$ v1 N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" Z! [' c5 [2 o1 u* a
  20. * kind, whether express or implied; without even the implied warranty& g" G! [. M1 }1 h* B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 U# x, Z0 J+ ^* L7 c3 g- T6 I
  22. * GNU General Public License for more details., I) d8 @. ^7 _
  23. */
    % O! e- ~; O5 D' K4 F* r, [  k

  24. * c: w) ]* v! h7 b
  25. #include <linux/module.h>5 k4 z" {) S6 G, P9 d6 F+ [: i
  26. #include <linux/init.h>- |. c  r& P0 l; N! m1 E( J3 n
  27. #include <linux/errno.h>; f8 ~% c# |, F: {: J
  28. #include <linux/types.h>  l7 u" ?! _2 J6 h: z1 p# C
  29. #include <linux/interrupt.h>
    + I8 P' U- [  u7 G9 y
  30. #include <asm/io.h>
    , \  @: X+ M. b. s
  31. #include <linux/moduleparam.h>
    + Z4 C2 I7 D! O
  32. #include <linux/sysctl.h>
    ' D. D8 D+ l6 y/ D3 w; f- {6 _
  33. #include <linux/mm.h>1 A+ \# d: e+ p: e
  34. #include <linux/dma-mapping.h>
    * i+ P# g, I9 Z2 G: l( ~

  35. ( E% I2 n$ G8 O/ ^; g
  36. #include <mach/memory.h>, ^: o  F, g8 K$ H* z2 \
  37. #include <mach/hardware.h>$ w, P+ P- {  d1 e6 l
  38. #include <mach/irqs.h>0 l5 J* f9 z: y+ E3 F" A' L: e
  39. #include <asm/hardware/edma.h>9 W  R3 N# S% r7 h  h
  40. ) M8 q- G- [% s. K; p
  41. #undef EDMA3_DEBUG- M% n, X3 d6 K2 R/ H0 ?1 h; _
  42. /*#define EDMA3_DEBUG*/  ]6 H/ X% b; k4 O! u
  43. / ~* H) c" U: I7 p; d) W1 X
  44. #ifdef EDMA3_DEBUG
    ! w% c( z' ?; O: E0 }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( b$ r/ o. A9 m: ~4 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 N6 b% P, E3 D8 u6 ^" W3 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), z0 r+ B& i1 P' m8 P: k$ t4 M( Y  i' }
  48. #else, y; X' d) ^$ J4 x5 X
  49. #define DMA_PRINTK( x... )- @! K2 R8 t* c0 n+ m; b7 I
  50. #define DMA_FN_IN
    - E3 Q4 |0 C* K8 _% f5 Y
  51. #define DMA_FN_OUT: \* M+ m1 c4 Q5 k9 k) q/ Y6 B: Y
  52. #endif
    . ]/ D+ A; g8 [0 A% h( V* J9 U
  53. + f  q" W+ J1 h) e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 k9 F- v' \7 J$ y  M; }' y6 R; t3 l
  55. #define STATIC_SHIFT                3
    7 Q( q3 J- h  c. z% |! S0 t! G6 k% H
  56. #define TCINTEN_SHIFT               200 Q  {3 M1 E; k/ u! U8 o
  57. #define ITCINTEN_SHIFT              21# m! a! r5 w9 l& q5 p
  58. #define TCCHEN_SHIFT                22
    0 e. T) L8 L8 @9 Z/ J  m: g; t7 S
  59. #define ITCCHEN_SHIFT               23; E+ _- G8 B5 h
  60. 3 m  r% `% {" o6 r- [/ ^+ P, K9 \3 G
  61. static volatile int irqraised1 = 0;$ v7 R9 D6 L( B/ K& ]; _3 S- k
  62. static volatile int irqraised2 = 0;
    $ X) I' \! r- R4 q
  63. 8 \/ J( o6 |/ J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) I5 a# G+ O2 @& k3 ~: l! M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " Q/ t2 b9 |: O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ r1 A9 D& S8 l* n( `, ]0 i$ T
  67. 5 k& u/ M  c# O9 N4 V  K
  68. dma_addr_t dmaphyssrc1 = 0;- W8 l' P/ i  a, C% j
  69. dma_addr_t dmaphyssrc2 = 0;
    : p( R; U& R! E3 _
  70. dma_addr_t dmaphysdest1 = 0;7 J5 p1 G6 q7 B3 U  [
  71. dma_addr_t dmaphysdest2 = 0;1 `# _) p" q7 d; V/ s
  72. 8 e+ D5 w5 G& y2 N# s" B7 _: V2 C
  73. char *dmabufsrc1 = NULL;
    8 x" I  q" I) P5 |% u+ `2 N& j4 Y
  74. char *dmabufsrc2 = NULL;
    . b. J- z5 k, n( X2 B3 F
  75. char *dmabufdest1 = NULL;$ n7 o) N! F8 t4 v: ?0 J" a
  76. char *dmabufdest2 = NULL;+ t- }& A$ ~# h+ ^8 s
  77. 6 z6 y! r: p- j, n! Y2 I
  78. static int acnt = 512;0 E$ o& U& }2 g
  79. static int bcnt = 8;; ^, J1 D6 r5 {
  80. static int ccnt = 8;& ~" Q* u3 y# v- |. A( C7 @

  81. 7 E8 i% t0 v* {; M6 s* R( T  C
  82. module_param(acnt, int, S_IRUGO);# a0 P$ f. K- k! ?, V& W
  83. module_param(bcnt, int, S_IRUGO);
    1 q0 O- n  h! }, x# g6 p8 @8 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) Z; v; x  \. x" ]( ?  |! a" B
$ T- }+ Y' U3 Z- R( c1 _$ }* R      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) E2 F3 \# g3 k+ t4 ]# i( R* L/ U5 ?$ }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& B: j2 y& ?' x4 ], T1 o$ S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- A" A( s4 ^6 V
( Y, E* e! G. Q/ @% l
6 I8 P0 V/ X- U  \2 U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-27 02:28 , Processed in 0.038971 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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