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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ C& x: l3 f9 a- x9 x
  1. [code]EDMA sample test application
    & H7 p! O( E* e5 T: r
  2. /*+ e: w" r1 _) Q7 l
  3. * edma_test.c! ~" b- F. i4 D& m5 q
  4. *0 x( F9 `; c$ O3 c2 A1 B% ~
  5. * brief  EDMA3 Test Application
    / o; Z8 G7 U3 f4 t  M
  6. *7 J( L. t- G. l/ e2 c5 O
  7. *   This file contains EDMA3 Test code.4 w2 T" c0 [8 j3 {: E
  8. *
    * T9 f2 j5 f) S: H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 f3 \: D7 R0 L9 ~7 g" z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 a6 i0 i' {* ?
  11. *         TO CHANGE." B7 m$ l9 u+ L" Q
  12. *
    6 g7 ^0 P  m6 C- H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 ^+ J& }: {) I( i
  14. *
    / M- Y' b, j# Y0 K3 A- f9 y
  15. * This program is free software; you can redistribute it and/or- x& L0 h- A# w, F
  16. * modify it under the terms of the GNU General Public License as' ^  r0 Q/ r1 ?& h! R" V  F
  17. * published by the Free Software Foundation version 2.
    ; O0 p8 z$ [) V7 b+ Q
  18. *
    - ]+ b. F# R. L% Q. x' z$ G* d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 h* L, U1 X$ ~8 F" w$ [* S
  20. * kind, whether express or implied; without even the implied warranty0 u! z3 L  Z( x9 W7 ?4 q" f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- K- h& B8 H) I: o
  22. * GNU General Public License for more details.
    - q6 f7 G2 J; ]0 p6 l) D2 S7 W
  23. */1 @  b0 D4 Q3 P6 y/ S+ _

  24. + I7 N  I" j* e1 s1 P/ a7 m
  25. #include <linux/module.h>
    " v' `; q$ Y  v. l7 x) R% q
  26. #include <linux/init.h>: R/ {" s: `- N/ F  H3 h. H
  27. #include <linux/errno.h>
    # M) E% n; G) k
  28. #include <linux/types.h># M/ }2 q$ x% C, g; t5 b1 @
  29. #include <linux/interrupt.h>
    5 G1 O6 i; Z; h
  30. #include <asm/io.h>
    / C6 F! Q1 |) {  R9 i3 s) Y
  31. #include <linux/moduleparam.h>% a: m/ ^+ }4 e3 _: o  g
  32. #include <linux/sysctl.h>. z" f" ^& g2 H' G
  33. #include <linux/mm.h>  C, b" y! h5 L; Z" X
  34. #include <linux/dma-mapping.h>
    . |4 h1 w( C+ `: y1 P" @# ?

  35. # S& ?; |) }7 Z1 Y! e' f. ?: ?
  36. #include <mach/memory.h>
    * Q4 I7 K( U( U# q
  37. #include <mach/hardware.h>
    , L1 ~" {& ]1 S
  38. #include <mach/irqs.h>
    ' V9 `: @& A+ N9 t5 z
  39. #include <asm/hardware/edma.h>
    8 B( Y& N! B5 {' ^
  40. 4 R& V# T* s/ j7 V5 X1 J# V. S; y2 r
  41. #undef EDMA3_DEBUG) U3 j0 u9 I, |4 \
  42. /*#define EDMA3_DEBUG*/1 p8 _$ _' B2 r2 n4 a1 s
  43. 8 ?) O; {3 a, e$ }0 X$ B
  44. #ifdef EDMA3_DEBUG" U6 H, x1 @# }9 i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 }" {# e  r( M0 m% X3 |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( k) y  m; e9 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 y& w( f2 G' v6 ?
  48. #else
    . m, D/ ]; E5 E" e6 {: T
  49. #define DMA_PRINTK( x... )$ n$ \- _$ }) k/ v
  50. #define DMA_FN_IN
    ; j6 U7 v+ p! U- W; X
  51. #define DMA_FN_OUT
    4 ~$ M! D4 T# ~7 D
  52. #endif
    : u  V0 F/ D" N" a# {6 `* l+ X

  53. ; S" L' q, ]; f& C8 U' T! A- }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 G- n3 R5 U: B
  55. #define STATIC_SHIFT                3' C6 q5 T, [/ F! s* O
  56. #define TCINTEN_SHIFT               209 V9 u& v; ^2 I: g: _5 D: w3 B2 F
  57. #define ITCINTEN_SHIFT              21
    2 M' j9 }" @& h9 v& z
  58. #define TCCHEN_SHIFT                22& O3 }+ `! O% h7 N6 l' [# `
  59. #define ITCCHEN_SHIFT               23' [# y: p! E6 H2 t! n
  60. 5 w8 c; f# s6 V6 _
  61. static volatile int irqraised1 = 0;0 k* w: P. R$ C
  62. static volatile int irqraised2 = 0;
    , ], p% C2 L* A7 O! X
  63. 4 T( W7 E0 z) t& _5 S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & |9 E% M# p* A6 Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # W" N1 e4 t+ z* ~2 T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Y+ e( u0 s& y: r0 i- {
  67. 1 n) z: A+ X" R* G
  68. dma_addr_t dmaphyssrc1 = 0;
      B7 {5 f. u3 T4 B0 Z/ M+ S$ t) A! H
  69. dma_addr_t dmaphyssrc2 = 0;
    3 z7 q+ I- U' Z$ z
  70. dma_addr_t dmaphysdest1 = 0;1 `% Q- ]5 k4 ?- Q: _
  71. dma_addr_t dmaphysdest2 = 0;9 a" Y6 c3 R4 z- |* E4 |( Q( n  _( |

  72. $ e, d, b7 k& ?( q1 u6 O
  73. char *dmabufsrc1 = NULL;
    8 c& p8 _) a2 `6 _; O7 X9 }
  74. char *dmabufsrc2 = NULL;+ Y' v9 \( B) n. U+ z
  75. char *dmabufdest1 = NULL;
    , g! G, m" N; L7 h; {0 j  R0 P7 d
  76. char *dmabufdest2 = NULL;2 s! l! u& d) G
  77. # ^* Y0 x7 w! T* g" C
  78. static int acnt = 512;, B& S, g! _: F. q# S" j
  79. static int bcnt = 8;
    & x, U5 c  u0 p
  80. static int ccnt = 8;
    # w2 Y/ T& N- z3 i; F

  81. 9 f' F$ u1 @" ?  P# |
  82. module_param(acnt, int, S_IRUGO);
    5 H5 l2 O; T# a8 X' e: b- q6 e
  83. module_param(bcnt, int, S_IRUGO);. N1 k6 h; C6 ?9 H' g1 \3 B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 D  M& D6 k9 d" Z" n

3 h: [  l, [/ X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ B% C( E( f: A. R5 d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 A0 Z1 T- u2 J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ p* F, `! n9 ^) T: G* Z2 F! b

7 q) W" r. ~0 C9 [9 G- t( o) x1 m6 K" W& l9 U; o* a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 03:03 , Processed in 0.042137 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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