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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 V( k2 [( e; X+ T3 a
  1. [code]EDMA sample test application
    2 a/ E9 R0 E1 @
  2. /*
    3 E3 o6 t7 f9 A' A
  3. * edma_test.c
    ) I. ]5 N( \, r! L4 u5 ~6 |
  4. *
    # }7 b3 E' S) V9 n; r- Z' V
  5. * brief  EDMA3 Test Application
    8 C: h& }2 y1 w, t& {: H
  6. *
    " V% j, y7 q* Z1 r- S
  7. *   This file contains EDMA3 Test code.
    % a7 s2 c  P( I9 g9 o$ I
  8. *4 o7 N/ m' k6 s; a3 K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 e- {4 U! ^8 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& L$ G& s( ]% j% B2 W$ I8 e! U
  11. *         TO CHANGE.
    , P/ R) \3 h) m1 r
  12. */ t/ ], A6 _0 [0 V: t! F% i: I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: w% O2 {$ e3 V* `) i
  14. *9 K4 l0 N3 d: w, f' M- Z, z
  15. * This program is free software; you can redistribute it and/or# V, `9 }) ~) `0 q7 J
  16. * modify it under the terms of the GNU General Public License as3 O/ z4 d6 K9 m% n  i) b
  17. * published by the Free Software Foundation version 2.
    % r' M: h. W2 q9 k
  18. *. y! C1 e( M9 Z+ Z9 B$ G1 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) P& y6 e, t% S9 l! B
  20. * kind, whether express or implied; without even the implied warranty* s, K8 D" z: B9 g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, E4 j* ^: }6 `6 Z
  22. * GNU General Public License for more details.; @# a9 k- G3 d  C& x" P1 \' h8 }
  23. */
    0 s- o, H6 G4 W/ S6 X
  24. . l* y5 K5 Q6 B  Q( w0 ?6 ^
  25. #include <linux/module.h>  L5 C: e6 G& v2 Z+ `
  26. #include <linux/init.h>
    ' a& ~, _4 o) @/ ]
  27. #include <linux/errno.h>, h7 V0 b5 G4 S# c+ }
  28. #include <linux/types.h>
    6 j# @" d$ l0 b) [4 g
  29. #include <linux/interrupt.h>. v. A$ G* V9 s/ s0 ~( V4 Z2 d# V5 c. |
  30. #include <asm/io.h>
    6 m! m/ M9 c7 P$ B4 ]
  31. #include <linux/moduleparam.h>+ d' ]! ]+ b5 w  I  `$ m: p
  32. #include <linux/sysctl.h># T1 l' w1 ^; V: Y& _
  33. #include <linux/mm.h>
    + N" ?% N* E9 M6 B* U  [/ ^7 X# Y
  34. #include <linux/dma-mapping.h>
    % e1 L0 g/ R# e2 G
  35. 1 Q* }7 V! A% X4 E
  36. #include <mach/memory.h>$ C9 ~( K3 R0 X+ O
  37. #include <mach/hardware.h>
    $ @3 k" X. I  ?: J# {2 j" n
  38. #include <mach/irqs.h>
    # F) `( Q0 j# c' p) F
  39. #include <asm/hardware/edma.h>
    # A6 e& c; l4 q9 M' s: _9 u* s

  40. 2 I4 f7 l1 p& r  X
  41. #undef EDMA3_DEBUG
    9 K7 m) p; `* B* d8 H
  42. /*#define EDMA3_DEBUG*/
    & m! b' E" O3 c& D2 d( j, W- \* v
  43. 1 B* g, _+ p4 q; [
  44. #ifdef EDMA3_DEBUG
    . C' B( O% O: E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + ~. n3 P( g5 `' j2 ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' Y; J: i3 i  z, _% f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # M5 e2 V; g+ g; U. J! [: F" K- @
  48. #else9 Q1 Y  N* _1 W2 B$ w
  49. #define DMA_PRINTK( x... ): d" ^7 a# @# q
  50. #define DMA_FN_IN5 u" \) R9 o4 C2 X
  51. #define DMA_FN_OUT# n+ |# n0 t, G7 g% c) s# [
  52. #endif7 w# \( J2 Y! B& K8 E" }+ P/ E* ]
  53. 6 y7 c; N& B& U! m# `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& @. b2 t- w; }4 y0 W
  55. #define STATIC_SHIFT                3& C: h$ I1 ], \5 o' w
  56. #define TCINTEN_SHIFT               20
    . o2 G. }/ B$ y0 B9 Z) \! R
  57. #define ITCINTEN_SHIFT              21% c* r7 T/ w" i, L7 U. }( v
  58. #define TCCHEN_SHIFT                22
    4 L: \6 q: T) Y% g
  59. #define ITCCHEN_SHIFT               23! L$ F5 @; c5 Q: S. M  ?3 ?+ a2 b

  60. 4 L) n  |& }6 |/ T0 e/ o* h4 L
  61. static volatile int irqraised1 = 0;
    , _& i; J5 {! c2 y3 J1 M$ I
  62. static volatile int irqraised2 = 0;! t. H1 u9 V3 u$ k& U
  63. & V9 [' Z/ H2 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 o3 Z, B, ^1 K0 l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 ]2 u' Q/ `' d* M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ {, Y# B6 T, O  t2 Z, I5 w
  67. $ K. q8 ~8 x* u3 A5 n
  68. dma_addr_t dmaphyssrc1 = 0;9 J- x& H! N0 _# [3 j2 l, [3 |9 x
  69. dma_addr_t dmaphyssrc2 = 0;
    ) t8 k6 c# d" z- c8 n4 k6 j2 F0 C0 x
  70. dma_addr_t dmaphysdest1 = 0;% s6 @0 o6 n) N7 q% L& _$ {
  71. dma_addr_t dmaphysdest2 = 0;/ [" M# Z9 y  d) Y7 C

  72. 5 _8 Z& X: [0 c$ z8 \1 d) g) W
  73. char *dmabufsrc1 = NULL;* m3 V+ u) W6 v# y: v
  74. char *dmabufsrc2 = NULL;: g; n( \" x0 n
  75. char *dmabufdest1 = NULL;
    7 s1 ]5 V$ g9 O0 O+ _/ L; L
  76. char *dmabufdest2 = NULL;2 X+ [" i$ Z/ o5 g

  77. 4 K% Y/ a3 W6 N4 \; N  A/ f
  78. static int acnt = 512;
    " l4 T- H9 c" m' j! m/ p
  79. static int bcnt = 8;
    % u2 C) r. E$ ]* i
  80. static int ccnt = 8;
    0 ?  S$ a4 @5 N$ H* n8 I
  81. # a) N/ G4 _+ X5 y  u& H" M
  82. module_param(acnt, int, S_IRUGO);) ^  z" \/ c+ R, w5 i. X; E4 r
  83. module_param(bcnt, int, S_IRUGO);; e" K6 X$ I- V/ |# v  S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 M, C  y) A( U. q# E/ T- O  z) a/ H+ D6 g( v  n! L+ h* t" o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 X7 \! A/ v. v& K  _; earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 Y  P4 P, U1 q5 X3 R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 Y0 x4 M' f2 B- m' [& e4 A; M( d" A

- h8 U" k5 F) T5 u* Z& E, a/ L& V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-6 02:36 , Processed in 0.040068 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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