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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& O% x0 J2 G& ?+ h- I
  1. [code]EDMA sample test application2 h# K( \7 a, i5 p# B6 n6 c
  2. /*" R  z. @5 s9 u0 R  C" A" V
  3. * edma_test.c
      q  y6 O$ |; [" Q# }6 e+ X
  4. *
    ; [: k6 t' w7 q, l( i# d$ M
  5. * brief  EDMA3 Test Application, S# v& Z# B( X" h" i3 ?
  6. *
    - @! L, f9 E3 ~5 u# [
  7. *   This file contains EDMA3 Test code.0 x) I' X2 S2 i2 i6 v9 _5 I
  8. *
    5 n' G" P' ~. j* {5 j' u" M9 ~3 {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 s/ `7 ?( ?' [1 }4 H1 q( B8 V: D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 _+ j+ S3 c- `5 ?9 d0 U
  11. *         TO CHANGE.
    - M6 [7 v1 c/ F* i
  12. *
    / G* m3 g0 L4 j+ g5 b7 m+ A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * r/ z/ c5 B2 b6 H* \6 a
  14. *
    ! f" p: f! N( B
  15. * This program is free software; you can redistribute it and/or! V% _0 Q" Y0 i0 r
  16. * modify it under the terms of the GNU General Public License as
    5 R) `" o3 S4 r4 N0 I. ?+ j
  17. * published by the Free Software Foundation version 2.
    1 F3 Z$ N! C9 f4 C* ~
  18. *
    / f4 C! F, A/ @1 p$ v$ J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& Q6 t" j1 Y9 i7 i9 v- s% Y
  20. * kind, whether express or implied; without even the implied warranty) I8 \8 N) L4 G  A/ ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  {7 F+ [  M) x
  22. * GNU General Public License for more details.
    % ^) j6 l" ^! Z% A/ P2 W
  23. */! W( i& j* S+ ]

  24. , M: k7 u6 \, C! @( E! [2 V8 C7 T
  25. #include <linux/module.h>
    - Q! `: \& Z0 q; U  X* w( h
  26. #include <linux/init.h>
    . A5 a8 t. j! {$ {6 T9 N
  27. #include <linux/errno.h>
    5 L7 y  h# B2 l2 G/ y! ]
  28. #include <linux/types.h>. a8 N  m$ H, G. \$ y/ E+ a
  29. #include <linux/interrupt.h>) I3 J$ w: {& ?) {2 S- M
  30. #include <asm/io.h>4 C9 \) b$ E- _4 p
  31. #include <linux/moduleparam.h>
    7 w! x0 c8 i1 t. z4 z6 \1 K
  32. #include <linux/sysctl.h>
      N2 f, |5 S" E1 n$ F
  33. #include <linux/mm.h>
    0 W, S6 S4 u( x
  34. #include <linux/dma-mapping.h>+ R! x( ~8 E- Y. C: w+ j& y
  35. : D2 S! J) |5 D4 G4 H' `
  36. #include <mach/memory.h>" G& E7 a$ j- s* |
  37. #include <mach/hardware.h>6 w7 e8 B$ K2 s/ M( ]- \* R7 R3 N
  38. #include <mach/irqs.h>
    ' ~5 \; Q5 G3 j3 X  {
  39. #include <asm/hardware/edma.h>
    0 p1 L# d' o3 e& N2 W1 z1 m( `3 n  {
  40. 6 P- R0 g, _) T' t
  41. #undef EDMA3_DEBUG
    9 x: d. y+ [5 ~, ^9 _9 _) l5 D
  42. /*#define EDMA3_DEBUG*/
    * S: ]; D8 o" @, d+ _% `( \. X
  43.   }: Y6 y" l5 [3 a' ^, n* N8 k3 K! ?
  44. #ifdef EDMA3_DEBUG
    1 D) Z. L/ N, A! a8 c- m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 w( x" X9 S8 K( p% d) |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      x" q9 @, J6 _4 V& L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 C& R% s8 F+ U) X: O( }
  48. #else9 K0 j. p" ]6 Z# H6 F
  49. #define DMA_PRINTK( x... )8 N9 K& X- j- A9 s: H2 B/ k- O
  50. #define DMA_FN_IN
    $ i2 U2 _2 j$ ]2 y
  51. #define DMA_FN_OUT5 Y( \! ~# t% |
  52. #endif
    # X5 k3 N3 K' }9 j

  53. ' l- S" e5 ~3 x2 {% T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! w" T9 @, N1 @& F) p- r' a) J
  55. #define STATIC_SHIFT                35 n  C# t+ `# ?: F/ N; S
  56. #define TCINTEN_SHIFT               205 }& Y" a# _/ [2 q+ |/ k7 Q6 {
  57. #define ITCINTEN_SHIFT              21
    - b; x) ?+ @9 W5 F
  58. #define TCCHEN_SHIFT                22' S, b$ F, ~6 s( }: V- c
  59. #define ITCCHEN_SHIFT               23& R& L, g8 p% c9 f0 x5 ~8 {# ~

  60. ; @7 i$ X+ a7 L! s( N
  61. static volatile int irqraised1 = 0;! l: C7 `; u" l6 k1 `; g
  62. static volatile int irqraised2 = 0;4 y$ i0 u& D4 C# E0 _- B

  63. ; }% T# p& i9 a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" ?2 X* m4 K1 b3 [4 d5 n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 b% `+ V/ ]( V: _2 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 e0 k' i6 f) h. K1 O6 l# |; T

  67. , T2 \! \& ]( t0 q2 e' r8 u3 S
  68. dma_addr_t dmaphyssrc1 = 0;
    4 g- T7 ^8 A# B2 x+ T$ U* l, z% k+ x
  69. dma_addr_t dmaphyssrc2 = 0;+ S2 G# _. B6 r
  70. dma_addr_t dmaphysdest1 = 0;/ k6 J3 I$ S: l) l' [# \
  71. dma_addr_t dmaphysdest2 = 0;
    - i3 m9 G9 A9 N# G" y

  72. " s9 i: s& s/ f+ C1 _3 q! z
  73. char *dmabufsrc1 = NULL;# n2 X6 D0 a3 M' U% e# I/ R6 V' D
  74. char *dmabufsrc2 = NULL;
    / W  g8 \% \  A; {
  75. char *dmabufdest1 = NULL;
    0 K9 [- J3 m' A! }9 F7 L, G8 L
  76. char *dmabufdest2 = NULL;
    / n' n* G9 U- p/ l, Z+ M5 D

  77. ( h4 Y6 T6 b) l$ d
  78. static int acnt = 512;# X5 J3 t* M: D% A" C2 y
  79. static int bcnt = 8;
    - e! z1 w0 t, A$ e
  80. static int ccnt = 8;
    " J5 X8 E- f- J8 X9 \

  81. * f* u# M; L) O, j! S
  82. module_param(acnt, int, S_IRUGO);
    0 |0 X3 `' N% q9 k" {- {
  83. module_param(bcnt, int, S_IRUGO);
    " s' D( O/ m# X- |1 z0 c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* c% D- ~/ q- B# j' @$ @" i- [, o4 K+ e2 `4 w: }) @$ n7 C( `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 m! q& f" v: ?* g. ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 A' @4 R! i) C2 C* G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, @* Q( \" r2 R: O9 U
' V; t7 w6 j$ y+ v. z6 n" i/ D% H! r+ n  z+ q( B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 00:06 , Processed in 0.038750 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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