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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ A6 n1 X/ g0 R
  1. [code]EDMA sample test application
    , e! _/ L; ]* b
  2. /*
    0 k: i5 P) M4 U  d: H
  3. * edma_test.c' l/ h9 m. c; C1 V- j9 O& Y7 e
  4. *
      `0 |7 r- K. h. _& `0 x: r$ g
  5. * brief  EDMA3 Test Application
    0 l3 s" z* p) U. S
  6. *- j8 |  l  d7 C7 g$ l
  7. *   This file contains EDMA3 Test code.9 H7 n5 x& e1 H) b6 y' f3 K' h' d
  8. *
    ) a' E" O6 f' Y! b' \) ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 q/ ^0 M0 T1 c8 n' E8 T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) n2 k: S" |" m, Z# A
  11. *         TO CHANGE.' w1 }! y" H, M6 l. r9 u- C4 J* O
  12. *
    ' R7 J- |( ?/ \, ]( q7 {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; n# g* x1 W+ H- E6 K+ w! S2 p
  14. *( ]& f0 Q' K4 D8 g
  15. * This program is free software; you can redistribute it and/or7 [  w6 Q3 _' Y) R1 ]: c
  16. * modify it under the terms of the GNU General Public License as' g4 h* H' Y' m5 j" |  F- W7 C# S
  17. * published by the Free Software Foundation version 2.
    ) I! k" ]* V) b0 l2 R/ U7 U' K
  18. *6 H( t+ x  n8 P6 s1 A# |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 X2 j$ R+ @: a9 _/ z; m1 B+ t8 H
  20. * kind, whether express or implied; without even the implied warranty4 h" X0 B3 V: X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  j; z6 \4 p8 w8 p
  22. * GNU General Public License for more details.. P2 ~0 W! u7 Y" a
  23. */8 Q7 j" h2 M1 M

  24. # [9 J6 S& U, e; l2 v
  25. #include <linux/module.h># c) o" \7 E) G( j6 c" v" [
  26. #include <linux/init.h>" o* A" t; ^6 C: O, [
  27. #include <linux/errno.h>
    2 x& R& M% Z5 o8 t
  28. #include <linux/types.h>
    # e, |# X, Y  G5 Y
  29. #include <linux/interrupt.h>5 W: U6 B) X& P1 p' |
  30. #include <asm/io.h>4 _+ C2 ?- c0 k7 ?* Z# A
  31. #include <linux/moduleparam.h>0 }1 r0 h5 y* i: s9 S
  32. #include <linux/sysctl.h>! n* q( K1 C8 ~
  33. #include <linux/mm.h>, N2 L/ {6 ^8 t1 l
  34. #include <linux/dma-mapping.h>
    + f0 u9 f0 b! g, [9 @
  35. & q  h" b  q" K& u4 v. b4 X
  36. #include <mach/memory.h>$ R: a) W6 q" K- m/ K
  37. #include <mach/hardware.h>
    3 h( c* X1 R  r4 p- ~+ d+ ?
  38. #include <mach/irqs.h>* E/ ^' d8 W. B; L7 O
  39. #include <asm/hardware/edma.h>7 T8 E/ ]: ]: D3 f$ J9 J5 U+ O, v$ N5 |
  40. 3 D; Q9 B$ ~  g3 ^( A. a% E
  41. #undef EDMA3_DEBUG+ I9 w. {: @% B# o( ]
  42. /*#define EDMA3_DEBUG*/
    2 |6 a$ N* [9 r3 ^5 ~

  43. ! e$ m% P+ V! A, s- q6 V( R
  44. #ifdef EDMA3_DEBUG
    9 j5 Z# p+ l& B( I- E1 o" B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ V7 A1 ~: g! b: M: Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 k2 ?+ A& i( a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , ?/ R% Y! r  O; z% x8 E
  48. #else
    4 `, r9 K5 A* g. g
  49. #define DMA_PRINTK( x... )
    3 A6 W( M2 g- A) j  T6 J3 w5 `
  50. #define DMA_FN_IN
    6 s  }$ D* [) O# z
  51. #define DMA_FN_OUT' W# a: O7 a2 h, \5 _' x" p0 g9 W+ s
  52. #endif
    ' g& {/ w' C& v+ p
  53. 5 \& \. N9 A2 V0 b# b$ b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 I; r5 S( M' G% T. W
  55. #define STATIC_SHIFT                3
    - ^7 i0 i1 n, B4 e! y8 [
  56. #define TCINTEN_SHIFT               20
    8 s0 v" p1 `* V! K0 \- O; X
  57. #define ITCINTEN_SHIFT              21
    3 X# L0 x9 q4 g3 s. ?  H
  58. #define TCCHEN_SHIFT                22# i, E& i  }6 V. v- u
  59. #define ITCCHEN_SHIFT               23$ I; e; q- b$ S9 X  a9 M( s% `- g7 P

  60. + b# Z; R( R  Y9 F( v4 m
  61. static volatile int irqraised1 = 0;
    / t8 z  o& g0 i& c( x
  62. static volatile int irqraised2 = 0;0 T' z3 N) H6 a
  63. ( s; y" M; a3 C8 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . C( y; y0 Q: ^! Q: ^1 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- e' w) L6 N& i; G% U" O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 c5 u; N4 `! {, s( Z1 ]7 y

  67. - K$ j# _. V, |( d4 g. J
  68. dma_addr_t dmaphyssrc1 = 0;& G/ p# K1 }: u; N6 u# ^7 Q
  69. dma_addr_t dmaphyssrc2 = 0;9 n. n5 [! G% p7 N* q/ y- W9 [  t+ t
  70. dma_addr_t dmaphysdest1 = 0;$ G( D, T6 e$ j2 k3 M/ y" x
  71. dma_addr_t dmaphysdest2 = 0;
    , s& S, _3 L7 L( U" a& f8 T
  72. ( o3 U) M# Y9 m7 c# a& j) F
  73. char *dmabufsrc1 = NULL;; H+ f* g1 U; j$ {  E
  74. char *dmabufsrc2 = NULL;" G' G8 I+ s" t! ~$ C6 @8 _, y
  75. char *dmabufdest1 = NULL;
    3 v8 g9 z+ D. `# D/ d" [9 a/ j2 @
  76. char *dmabufdest2 = NULL;* H6 O1 g% c5 _

  77. 9 G; I% d' C$ |* Z# J
  78. static int acnt = 512;$ s1 F! `' {3 P" ~
  79. static int bcnt = 8;3 _8 _+ x4 S( _2 h  V4 s- p7 M
  80. static int ccnt = 8;8 F3 R3 Y2 D( _6 h, I
  81. 8 w* g# n, f2 a( l2 o# N
  82. module_param(acnt, int, S_IRUGO);5 u( Q: v" P& T
  83. module_param(bcnt, int, S_IRUGO);4 I6 K( L: ]. L& J1 ~* r) d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. R. i) \0 R! d9 W7 _0 Q6 ?8 N( E* L, G7 h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ v/ N" S% h" x; C/ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 w5 t' p9 K8 P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 N; @* u3 N9 v- Y6 i
7 l. k8 I5 o& A
1 [2 A) L: H8 N+ d( t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 19:40 , Processed in 0.037715 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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