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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, L1 c$ i) v9 y
  1. [code]EDMA sample test application
    $ M2 B* s' i" w" C; a
  2. /*0 Y9 B% Z- r9 R
  3. * edma_test.c
    ) N5 ]7 c/ z! d! j$ o, }
  4. *
    . t! r  {! k" q7 C2 b
  5. * brief  EDMA3 Test Application9 M# W; {4 x6 r) ^- W) c8 E3 w* c' d
  6. *
    9 F5 Q8 D! c2 G2 Z
  7. *   This file contains EDMA3 Test code." |/ c5 |! l2 M; J) m2 g
  8. *# @8 I  Z1 c( i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ i4 S  P4 _; q+ E+ o# Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 g5 a) h( S+ a: B0 o# h
  11. *         TO CHANGE./ p! r. F* ^7 M5 q9 i2 Z3 w
  12. *0 ]8 X- ^$ A, H/ h+ S; k7 i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / L+ ]( w8 h) H5 s7 s3 f  X( \
  14. *$ e2 n- w2 L9 u5 b
  15. * This program is free software; you can redistribute it and/or
    / J6 N1 b  ^" M$ I( S
  16. * modify it under the terms of the GNU General Public License as
    4 N5 m+ ~+ w7 W, A; g" G* {, T9 i
  17. * published by the Free Software Foundation version 2.! n; m5 Q$ U6 k1 F- [( W
  18. *  B. {# a; K/ f5 W+ c% N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / J) l8 F/ d( O$ F* C
  20. * kind, whether express or implied; without even the implied warranty
    % _* s2 r4 }) e9 P+ ~9 e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , o/ n+ a7 ]' k+ ]0 l0 K7 j5 A
  22. * GNU General Public License for more details.
    2 L1 O$ t9 z6 \
  23. */1 }2 c: S/ o1 t! A7 I, t

  24. $ i3 e# O9 C7 q6 k
  25. #include <linux/module.h>2 W8 ~( {2 l9 f3 _
  26. #include <linux/init.h>
    # b3 O3 o/ }7 {3 a: s$ V6 c
  27. #include <linux/errno.h>$ S" C  L6 t2 B# h& s4 i# F
  28. #include <linux/types.h>( x( S0 B- Y& P) ~
  29. #include <linux/interrupt.h>+ T( q* G* m) p" A
  30. #include <asm/io.h>0 Z2 r2 q+ L: q' n# v5 @
  31. #include <linux/moduleparam.h>
    ; L" `+ Q, A, P+ R- Q9 ?1 t
  32. #include <linux/sysctl.h>+ }$ t+ \, C+ g' l6 Q; i- ]
  33. #include <linux/mm.h>3 ]- E3 x. s1 A2 z+ c5 L  t5 {' m
  34. #include <linux/dma-mapping.h>' q$ a+ [% G, b2 a, [* ^) K

  35. + Z( k" O& `7 ~) v% X' C) M, b
  36. #include <mach/memory.h>8 v5 E% h2 n5 M* ]
  37. #include <mach/hardware.h>
    % k$ B' l1 i" v/ J( \
  38. #include <mach/irqs.h>
    6 T2 U! b% F: J# W7 [
  39. #include <asm/hardware/edma.h>3 J* x: t$ Q+ k2 V: Y, P+ ^1 f$ k
  40. 8 n4 e. ]' _3 S5 _. K% D
  41. #undef EDMA3_DEBUG. c6 h% S2 C: I9 ^7 q% f3 d3 N
  42. /*#define EDMA3_DEBUG*/
    - D6 d4 L; z7 k/ x0 b

  43. 4 D2 l& h* r- q# H( _" [/ B
  44. #ifdef EDMA3_DEBUG
    5 X. i, f; J2 q3 }3 F" F4 Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 U) }7 [5 r& j1 }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 n+ q7 f7 U: Z3 D. V7 x+ m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * x- K$ b$ m: M1 x7 i
  48. #else, \5 g2 v; h+ {) q& j2 }. W) \
  49. #define DMA_PRINTK( x... )
    / ~7 ]$ t$ z3 l3 ^( o8 f  K
  50. #define DMA_FN_IN
    8 P* x$ j8 X2 g# S" O$ b
  51. #define DMA_FN_OUT
    ; V: i/ }& C  ]% W9 ?1 l
  52. #endif
    0 C$ M; |4 F& J* S) l7 B8 j

  53. % }0 Q' \2 U. }; s* y! h8 b2 |" X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . v3 h+ P* q# a
  55. #define STATIC_SHIFT                3% N% ~4 W+ ?; J1 I3 ^7 f
  56. #define TCINTEN_SHIFT               207 Q! L/ M+ L' T) C- i: v, K
  57. #define ITCINTEN_SHIFT              21
    + u! }$ C/ c5 \" u% a0 E, s
  58. #define TCCHEN_SHIFT                22
    5 B/ ^' `% X$ ]
  59. #define ITCCHEN_SHIFT               23, D4 z9 c7 y+ J7 ?$ H' Z! H
  60. ! v5 J2 u3 N. d0 F# [! c- c
  61. static volatile int irqraised1 = 0;
    2 \0 Q3 z9 o3 ~2 s) L4 }4 C0 @
  62. static volatile int irqraised2 = 0;
    # j- D# n4 W: k) u7 o
  63. 9 R. }9 [7 S8 T0 M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : T! q9 [$ G8 d9 S- Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 {4 U( X7 ^" s2 K. w7 d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 O! K/ x4 g0 f. g, j( t/ X
  67. 7 u) ^9 D% a5 s" i
  68. dma_addr_t dmaphyssrc1 = 0;
    # Z% Z8 z4 @6 q8 `. {
  69. dma_addr_t dmaphyssrc2 = 0;
    ) J. W& S  u$ C' i* z
  70. dma_addr_t dmaphysdest1 = 0;
    1 K" G- I6 F5 t0 p
  71. dma_addr_t dmaphysdest2 = 0;, \+ z) t/ S4 ]' t" q. t* g1 w7 q

  72. / ^6 n& s. x$ d
  73. char *dmabufsrc1 = NULL;3 C7 b) A+ W, a  \# Q; ]0 E9 s
  74. char *dmabufsrc2 = NULL;
    ! ]$ H5 p4 N# }6 X7 Q, N
  75. char *dmabufdest1 = NULL;
    . s% h9 X5 j0 D& [1 w
  76. char *dmabufdest2 = NULL;
    8 E( j3 s: h' F

  77. . V# e! v$ x1 f& i" k1 D# \
  78. static int acnt = 512;* _2 \! p$ k2 ~
  79. static int bcnt = 8;' f+ {+ Y# \+ h
  80. static int ccnt = 8;
    6 E" ?+ w: M2 z; J6 ?7 U) ~. z

  81. 1 D2 y% J& L/ f9 @3 \, t7 b
  82. module_param(acnt, int, S_IRUGO);! M9 Q# ~) D) E( f0 [' I
  83. module_param(bcnt, int, S_IRUGO);! k" s" F0 ?4 Z/ }4 \4 j. S1 N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% Y0 C2 w" L, n/ Y' x' K/ c6 N* ^# G" Y' J6 T: A$ b
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ i" |" X4 O& v; w' U% d/ V1 c+ X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& r! c( f+ H% ~0 C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( D! ]; k, e0 B, F" t
6 Q7 J, ]  v1 ?
. l0 P% t! B9 [3 I" p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 16:24 , Processed in 0.061006 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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