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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) I, L0 D' l/ P9 R0 J2 g
  1. [code]EDMA sample test application! A, a6 Q- h& g6 h! e+ }4 `: Q
  2. /*
    6 y5 |8 v: z+ L
  3. * edma_test.c3 V7 J- U, V0 V  ~
  4. *$ @# C: D* ?  x' ]2 ^9 e" u7 J4 W+ N
  5. * brief  EDMA3 Test Application
    $ F, G4 c/ S8 v" p: }
  6. *6 m+ v7 m; ?9 p" R
  7. *   This file contains EDMA3 Test code." g' {: o+ l1 \9 D
  8. *
    ) B4 }1 k9 [( Q9 I4 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . z1 x& j& Y3 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 h9 w& M$ x* {2 O4 h1 Y
  11. *         TO CHANGE.
    & V" c- s, [* t- `
  12. */ Q4 K" y9 k& e2 P2 {# J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ y: R) \* d, a
  14. *
    5 m; \4 t+ W4 e
  15. * This program is free software; you can redistribute it and/or
    3 q. U/ e, b! S, E4 w% W
  16. * modify it under the terms of the GNU General Public License as
    6 P  l0 `5 i# y1 _
  17. * published by the Free Software Foundation version 2.$ h8 r9 d; B- c$ y+ k
  18. *+ }& u5 W) ~8 l' Q3 M" l6 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) k# O6 z* X" K( g1 |2 l- ?  R# ]5 ?
  20. * kind, whether express or implied; without even the implied warranty
    ( o  L% d6 Q) o* c2 k/ y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # w) j, j2 x$ ]1 k# A
  22. * GNU General Public License for more details.
    0 X6 h0 p0 B6 g( O' t6 g
  23. */
    + ?9 o$ J- q( }: N; ~& l% Y
  24. 5 r, [4 X8 T8 H# a' ?. q
  25. #include <linux/module.h>
    * n% b6 e* g( [% l4 c8 a& G9 ^9 A
  26. #include <linux/init.h>! _' x! L6 o1 K
  27. #include <linux/errno.h>$ U, O- k  A2 }# x8 u$ g
  28. #include <linux/types.h>2 K$ ?, m% Q7 r+ q1 l' B' U
  29. #include <linux/interrupt.h>& j& Z0 \- @# ~9 Q  S8 u
  30. #include <asm/io.h>
    ! q5 B* b. l6 A
  31. #include <linux/moduleparam.h>! x/ b0 W7 Q: k2 X$ x2 G
  32. #include <linux/sysctl.h>
    : J8 q8 z* L0 b! ~% ]
  33. #include <linux/mm.h>3 a$ n) O# ^( q
  34. #include <linux/dma-mapping.h>
    . ^$ g" K0 |9 _
  35. # L% s- R) g! w0 U
  36. #include <mach/memory.h>2 Y& o' o) \2 [
  37. #include <mach/hardware.h>
    8 E! X7 j( g' i+ q8 ~- E' G7 |. F
  38. #include <mach/irqs.h>
    ! X, U2 s3 r. [/ F
  39. #include <asm/hardware/edma.h>9 {/ M; n' G, {- ?5 e: P$ q9 V
  40. 2 k! D- q. S6 `8 J% [
  41. #undef EDMA3_DEBUG
    # F! B' w& z. I8 H' g
  42. /*#define EDMA3_DEBUG*/% M5 A$ ^6 V1 f

  43. : [1 t: J: k& T. V+ B  K& U
  44. #ifdef EDMA3_DEBUG, w* d8 c1 F0 r& @+ J4 @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / B: H. F4 e6 |) W" T: I! K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ a, Y4 j$ b) h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 v4 T) e; R8 a  @4 [5 T
  48. #else+ `6 H. H2 e% b+ @
  49. #define DMA_PRINTK( x... )
    0 V+ b: `) k7 I. ~$ O6 f" x8 o
  50. #define DMA_FN_IN
    3 k8 f2 z. X! }& P/ j* {+ `
  51. #define DMA_FN_OUT
    7 s2 {( s9 Y5 I! g
  52. #endif
    $ O+ j8 Z- s7 z/ b% ~9 }* C# m" `

  53. ! L0 j- P* F% C$ w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# g) r0 q* }2 \4 y: N0 B: m* V
  55. #define STATIC_SHIFT                3. f1 y6 D; i5 O. O4 R( e
  56. #define TCINTEN_SHIFT               20
    7 _9 O  d4 \" y) z3 B7 y
  57. #define ITCINTEN_SHIFT              213 V: Y2 p( v8 l: A( j4 i
  58. #define TCCHEN_SHIFT                223 H4 \% R8 a  t- f$ D: x
  59. #define ITCCHEN_SHIFT               23
    & c) \- `. L( ~  r+ o

  60. . }3 g4 K5 M& T
  61. static volatile int irqraised1 = 0;
    8 R! M  q/ R0 m: y" X
  62. static volatile int irqraised2 = 0;
    , S( z% X5 l4 \  L3 X

  63. ' o. ?  U+ A0 {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 D/ S9 F6 |9 K0 ^: N7 `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# {6 E) b, s7 [2 E" D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - q) i+ y7 P1 n: h) m/ N; m

  67. 6 k. P: ?/ i; F( y: C  r
  68. dma_addr_t dmaphyssrc1 = 0;% P! V6 ?2 ]8 q2 Z, g( k
  69. dma_addr_t dmaphyssrc2 = 0;- j6 @4 m. t: t* @5 I3 d
  70. dma_addr_t dmaphysdest1 = 0;) L. t/ j+ ~- ]! A* A' W- _3 X
  71. dma_addr_t dmaphysdest2 = 0;
    3 f- V; q' x; a) ^- B

  72. 0 s" k& @9 x, ^/ J  k9 }$ W# t, t
  73. char *dmabufsrc1 = NULL;9 \; d6 ~0 y5 Y# z4 |" q; H
  74. char *dmabufsrc2 = NULL;
    + f& d% z- C% b1 _1 n8 M) e8 N
  75. char *dmabufdest1 = NULL;
    " Y% F+ m, F; v6 C) V- a
  76. char *dmabufdest2 = NULL;
    ( ?7 ^3 n- |! {& |- x/ ~
  77. 6 Z. G) c& w( u5 W4 H* I$ z
  78. static int acnt = 512;+ m0 O$ a0 H9 A+ j% x
  79. static int bcnt = 8;% d- C. J) i% A+ I
  80. static int ccnt = 8;' J; n+ W/ I! Y! S
  81. : ?- n' V2 H- i: H
  82. module_param(acnt, int, S_IRUGO);) ]3 n' N  Q; L- j- S
  83. module_param(bcnt, int, S_IRUGO);4 F4 B% ^& ]7 E  M) R" C( a" o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; u, {* c: E2 f  b
1 f1 p0 c4 z0 g# X& {
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 v& O' o3 w+ L8 v  `- B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ k! [# R" P' O3 v" ]: D- J1 S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: A( u6 ^  `4 o. r: E5 ^) ]* K5 s* e! p2 _
6 M7 a0 ~2 z: ]' S0 s# N8 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 04:42 , Processed in 0.044841 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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