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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( b1 a! D1 X  z4 B3 U
  1. [code]EDMA sample test application
    3 W4 z) }* P1 r2 U- e2 }6 D
  2. /*8 @. U; a' b4 Y% L' r: W  s; v
  3. * edma_test.c: v$ e3 }$ R: p: Y. s- a& L
  4. *
    * @9 C; F0 r; [- o  `, \
  5. * brief  EDMA3 Test Application
    0 W' J& B+ N! r1 c- s4 L
  6. *
    9 w7 c# x$ ?+ K8 D" `$ q
  7. *   This file contains EDMA3 Test code.: @8 L) C/ G. n4 r
  8. *- i2 I$ I' d8 t2 n- B. H" q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + k$ a: H; b! Q- ?2 b8 E/ U: E1 R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  z0 i- E! n8 U: l. \% M9 e, e5 h1 \
  11. *         TO CHANGE.
    6 B+ I& U. t: Y" F
  12. *
    , l* ?* h8 ]$ t2 X( Z% d. D/ O: ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ x0 q" J/ k( E7 K# b
  14. *$ ?) B! p# k* Z' l# ?
  15. * This program is free software; you can redistribute it and/or. R* S4 h5 n/ k. Y6 ^
  16. * modify it under the terms of the GNU General Public License as0 Z) X6 L# A; Y+ I/ a; L, ^& B
  17. * published by the Free Software Foundation version 2.$ w( D1 p4 G' n
  18. *
    + N: z" {8 K/ Z' d* Y# t* @! {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 r! c/ o& o5 m3 U8 Q" o
  20. * kind, whether express or implied; without even the implied warranty1 i& a) V# ^4 A" @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : K: H* P4 }/ E/ T
  22. * GNU General Public License for more details.
    0 }) W6 e2 t7 d& x5 @! {3 r; u5 [
  23. */9 h+ i% i( @+ N/ U2 w* Z

  24. 6 Q' U6 Y( ]* B7 ^- L
  25. #include <linux/module.h>( |: I7 |6 o9 N; Y. X" }9 ~* q
  26. #include <linux/init.h>1 @9 H5 Q& o1 @  x
  27. #include <linux/errno.h>/ S" f5 C1 s1 M: x4 l3 X
  28. #include <linux/types.h>
    / {$ ~: G; _2 S3 D
  29. #include <linux/interrupt.h>$ d. H! @- a9 D6 x4 ~0 x; E% z
  30. #include <asm/io.h>
    & I) G8 I( V4 Z4 {3 _7 r
  31. #include <linux/moduleparam.h>
    + c. c* c* A* F; P
  32. #include <linux/sysctl.h>
    , J. B* \% A5 }- o
  33. #include <linux/mm.h>
    2 d1 ~; Q2 c( ^  w# d2 v
  34. #include <linux/dma-mapping.h>2 [( K1 C" p8 r
  35. , U# J" `+ o8 q6 \) J* ~0 H
  36. #include <mach/memory.h>
    1 d3 s5 g6 A% w- O$ [5 f
  37. #include <mach/hardware.h>
    . n& u. o7 \/ e2 s# {
  38. #include <mach/irqs.h>
    + i2 v* J. d6 V6 A$ l) V
  39. #include <asm/hardware/edma.h>
    : o9 Q* ]3 s. s7 @7 `

  40. . i5 I# C1 y; T& H" X
  41. #undef EDMA3_DEBUG2 \% \% r, [# c, a: W9 ?* T# G
  42. /*#define EDMA3_DEBUG*/# Z7 g* w8 E7 I/ [" l& y

  43. 2 ?& L" v6 A8 a/ f0 u( H1 @9 J
  44. #ifdef EDMA3_DEBUG0 \1 Q, P% K+ {2 U! m& Q; E3 c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) X7 c( @  K' s, a! l! L$ O% `( I+ `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% E3 J+ V  ]2 k& b  Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ k7 s% ^8 W6 p" C  c0 o
  48. #else! f% t% ?( p  ^! `4 {
  49. #define DMA_PRINTK( x... )
    & o5 q% n0 }) t2 ~" [# e. D/ @
  50. #define DMA_FN_IN
    " i9 }+ H6 t7 T6 K3 _
  51. #define DMA_FN_OUT
    * B; W2 J, [- R* N; M8 }4 M
  52. #endif% s3 @9 R) j, R+ M+ N& f/ H

  53. 8 z7 N: O. q/ @( ^- ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ {7 I* i" t; L9 W0 L
  55. #define STATIC_SHIFT                37 i0 ]( y4 Z" O$ ~/ D
  56. #define TCINTEN_SHIFT               20
    ' X3 v. N2 a- S6 Y- |5 b
  57. #define ITCINTEN_SHIFT              215 E# ^! o. w" u
  58. #define TCCHEN_SHIFT                22
    % G" A5 r# M8 P! n6 I
  59. #define ITCCHEN_SHIFT               23
    0 X. a0 ^% u8 n$ A

  60. # }! U; K$ ^2 E
  61. static volatile int irqraised1 = 0;
    9 b! @8 [+ O* i" z
  62. static volatile int irqraised2 = 0;9 O6 \3 @1 }, `9 X: W. S

  63. : \3 J( p$ j, T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; i% @; j2 R$ G; ~' b# I" T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ?( H1 R" V, H! E$ C7 e/ i" |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# y. d/ v7 C  {% |% v$ j' i* H

  67. $ e/ [1 |3 C+ q, G+ \. M% ?9 @
  68. dma_addr_t dmaphyssrc1 = 0;6 |( x, v/ [  L: K
  69. dma_addr_t dmaphyssrc2 = 0;* W# x5 x+ l. I+ _
  70. dma_addr_t dmaphysdest1 = 0;
    ; K- y) ]6 m: E) M) N% A
  71. dma_addr_t dmaphysdest2 = 0;7 p' q4 n* ^  T( [
  72. - |. T; B/ h7 X# }
  73. char *dmabufsrc1 = NULL;: ]5 S" I, v8 Q/ |, g
  74. char *dmabufsrc2 = NULL;
    ) C8 l! X0 W6 \0 T2 |2 ]$ j
  75. char *dmabufdest1 = NULL;
    , o$ ]2 H$ g7 W7 v) B& L6 R6 V
  76. char *dmabufdest2 = NULL;* \  v6 ]# W: k: x% f
  77. ) V9 X, f. `* x: u
  78. static int acnt = 512;
    8 }+ R- [  E0 l. k4 X9 @! z
  79. static int bcnt = 8;
    / [" Y" `7 H& J
  80. static int ccnt = 8;0 L3 O% z1 M2 H6 z9 h2 v
  81. ( B3 n% L& y. r& W
  82. module_param(acnt, int, S_IRUGO);
    1 v6 P" l1 P, h7 a' y
  83. module_param(bcnt, int, S_IRUGO);1 _; q- D) f- G4 n% D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; O; r1 C# p+ b
. k" j" l. A, V( [% M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% l$ [' @+ {9 i+ I3 I& u8 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 ?7 z. j! j/ c, h* z% D3 W) y' O2 Y2 ?4 e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( c9 Y! _* U6 x  S
* P* S+ n1 v0 v6 h; v$ }' b8 W. U% G
9 A0 Q3 c6 {0 U5 q( ^) H# i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 17:16 , Processed in 0.041884 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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