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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) c$ H, E6 B, O: d7 e0 a9 j
  1. [code]EDMA sample test application  F1 U$ w5 Q3 Q0 H2 b
  2. /*# M* }: |, x2 s/ G( F
  3. * edma_test.c9 ]4 ]; h& u9 _: U' Y3 `
  4. *+ i1 W7 ]9 O0 h1 m
  5. * brief  EDMA3 Test Application4 f6 b: \( A) M& G0 [' o
  6. *
    " |6 t9 D/ E8 {5 j
  7. *   This file contains EDMA3 Test code.
    & P' n6 G' x% F$ Q
  8. *
    3 q; g/ Q& c- u. _- v; |% |$ E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + x* v, D1 h- X" v" ]8 _7 m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * ~# \2 C9 e" O4 o) S$ ?
  11. *         TO CHANGE.% B# h0 S( H! i+ p
  12. *
    4 V4 C3 i3 [5 U$ p5 u# y0 e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( ^/ o' J/ q3 e) q
  14. *+ U+ p' J8 M: w6 |6 c
  15. * This program is free software; you can redistribute it and/or7 e7 E) ~& g' V, w9 p' L% R
  16. * modify it under the terms of the GNU General Public License as
    $ K+ E8 Z0 b" Y  p: x$ a
  17. * published by the Free Software Foundation version 2.
    7 F, s3 H% t( S
  18. *
    $ m7 ?9 C6 h  i+ H6 x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 F. }6 b& ?: I5 ?
  20. * kind, whether express or implied; without even the implied warranty7 q# D" R2 t! ?) _: w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; B. S  @4 l: Y8 K* o! N# v
  22. * GNU General Public License for more details.
    * h) L' y/ S8 i5 t7 w0 z
  23. */+ N9 P% _4 }+ Z% g" v8 H" u) t

  24. . Z6 U$ i+ ]4 v, ]# ^
  25. #include <linux/module.h>2 y& C# R: l' U# m
  26. #include <linux/init.h>
    $ P1 E6 z8 @1 J1 O( e3 L
  27. #include <linux/errno.h>: g, L+ ]1 ~# g! q+ X0 i  R# B5 r
  28. #include <linux/types.h>' W) U# g1 p; h$ Q* X
  29. #include <linux/interrupt.h>
    . x7 z& A. k( M2 s4 X
  30. #include <asm/io.h>
    ! E( g! [* Z3 r  v; n8 X
  31. #include <linux/moduleparam.h>
    1 @! Q+ j- D0 x
  32. #include <linux/sysctl.h>+ ~8 r8 i1 A9 ~7 c
  33. #include <linux/mm.h>) U- {: E$ F/ T! `2 O
  34. #include <linux/dma-mapping.h>; n) H: y) F  l1 D( G& d
  35. / t& Y8 C# n5 d6 k* `) I" I
  36. #include <mach/memory.h>
    ) @9 [+ [: ?  [. {6 G6 ^' H
  37. #include <mach/hardware.h>3 N- K9 G9 f" Y4 x, i- T; ~3 }6 ?
  38. #include <mach/irqs.h>$ D% I' D3 B1 ^( i& u9 Y
  39. #include <asm/hardware/edma.h>
    - b+ ^5 H' F+ E0 J

  40. ! F5 |7 D( C2 q1 h0 F
  41. #undef EDMA3_DEBUG
    ; V/ G4 G/ R# S; @# p- x
  42. /*#define EDMA3_DEBUG*/. f8 f1 e/ X& }) v" L) ?5 h

  43. $ c) v% D; H7 h% U2 |' S# t
  44. #ifdef EDMA3_DEBUG" P& p2 ?$ C# H- o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # q! G) r2 k$ ?) _8 x2 r- c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  Q; n1 }+ ~0 g, |, |: z$ E7 R) O2 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      l+ f1 P- U! A  l' T& l( h
  48. #else+ @/ J- C  I9 M8 m* S$ d
  49. #define DMA_PRINTK( x... )
    + u/ ?$ S5 o' h3 ~' Z; @
  50. #define DMA_FN_IN
    ( g5 y6 ?/ x) C  O( F: K( R* L
  51. #define DMA_FN_OUT0 ^' ~) P6 u; n% ]8 h- l8 p
  52. #endif
    + C/ X9 p( X0 R$ k+ n

  53. ; O5 l/ T2 X& d5 @" @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . |  E8 f: R0 ]! N4 e4 |2 }
  55. #define STATIC_SHIFT                3
    : g! ^! r2 Y* }7 `3 O, U1 p
  56. #define TCINTEN_SHIFT               20
    * |$ i. r8 ~+ |# ]" e4 E
  57. #define ITCINTEN_SHIFT              21+ Q7 Z  O, A" |' _, l3 `$ l9 [) E
  58. #define TCCHEN_SHIFT                22
    9 n& b0 N# g- P9 t5 E2 A! j1 i
  59. #define ITCCHEN_SHIFT               23
    4 _( R2 e$ i1 U% z! C: ~* H

  60. & _) Z5 t3 R% U0 G
  61. static volatile int irqraised1 = 0;, z8 ?# t7 S* q) j
  62. static volatile int irqraised2 = 0;! K9 d8 D, g" G% J; f
  63. / g4 W5 F9 u8 x7 ]7 ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ Y6 v6 C( l8 u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' P9 A3 C3 \6 j# u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ~5 J, J# C+ G1 ~, }0 H# a- E

  67. - {* }& @/ E2 H# W# y
  68. dma_addr_t dmaphyssrc1 = 0;' g6 P  f5 Z% I7 \3 o* ~1 C9 [" P
  69. dma_addr_t dmaphyssrc2 = 0;3 ^2 t5 [$ N8 X6 |) l9 ^
  70. dma_addr_t dmaphysdest1 = 0;/ }9 a/ Y" _( F- A
  71. dma_addr_t dmaphysdest2 = 0;! v/ R2 t2 V$ `1 Q. [! E* m8 v# }
  72. - R$ H$ O! H6 V8 C% I  \
  73. char *dmabufsrc1 = NULL;
    ' C* a/ e) h& [8 g' Q% B
  74. char *dmabufsrc2 = NULL;
    ) m) v, D& a8 p9 }1 C, }0 x. m
  75. char *dmabufdest1 = NULL;
    : |/ \! I* V7 f! X3 s* y8 s' V7 `
  76. char *dmabufdest2 = NULL;
    3 F9 d  s3 i  T1 F' }
  77. ( u) w# J2 c+ l" m; P1 P/ m/ b
  78. static int acnt = 512;
    ; H$ u: a4 R( s9 b8 a4 T
  79. static int bcnt = 8;
    9 I! ~& O! C& k
  80. static int ccnt = 8;
    8 A6 H* I$ E) Q
  81. 1 e  W/ E0 e. T$ t+ Q
  82. module_param(acnt, int, S_IRUGO);7 j' |0 e4 V7 j0 b) c6 A7 W
  83. module_param(bcnt, int, S_IRUGO);
    . P6 F$ G& p, {3 q1 J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# d0 R& W$ _- k0 c
5 d) }6 |0 X! d+ {. Z& ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 _4 U+ w) N0 w* h- ]* w+ t! N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- }% B% {5 }0 ^" I& v% G0 N1 U( U; \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 A& k8 Q- R5 q$ c; {% X+ S% \8 x& h
$ m! F5 F$ p2 X/ ]
, Z! w: b; |% k* X: v0 N6 {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-4 17:30 , Processed in 0.043599 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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