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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' S2 q) B5 O1 `( [" O# j! I
  1. [code]EDMA sample test application
    2 x7 ?3 \  F# \( Z1 ]2 Q$ @
  2. /*
    - ]- A5 j) t: i4 p) ^3 E
  3. * edma_test.c; `; ^, t+ M) D% d: }0 N8 p1 [3 U0 C
  4. *6 t' _6 Q/ z" Z( x
  5. * brief  EDMA3 Test Application
    $ n2 Q: z3 L, W5 r; |7 N5 |$ n/ r
  6. *
    # L, b! f# ^7 q# ^! ]7 M. o
  7. *   This file contains EDMA3 Test code.
    $ f% a6 ]2 l2 m/ O. @# k" g& g
  8. *" T5 d/ j) {$ Q1 i; B8 k* Y: K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: s2 d; A; l! P7 _. |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 f, j* [8 B8 l* C
  11. *         TO CHANGE.
    * r' }; |+ m7 |0 R" l
  12. *
    1 n( G8 W. T, b# }; k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 }) @  `4 ]6 [
  14. *
    1 }! ?; o3 M( J' }3 E! x
  15. * This program is free software; you can redistribute it and/or
    2 p6 i7 B7 L& M5 R5 l
  16. * modify it under the terms of the GNU General Public License as
    ; ?7 Q) r( n: u9 \( q: H% G# M. \/ g
  17. * published by the Free Software Foundation version 2.: j$ i7 A0 S" [$ P; m8 e. M( @( d
  18. *6 G3 {3 G* @) u: S0 O9 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& r7 _" x3 s8 B$ @. `' j" a6 C
  20. * kind, whether express or implied; without even the implied warranty
    8 ?' |7 }2 D0 x9 N8 q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 \8 N6 J4 {7 @1 z
  22. * GNU General Public License for more details.
    : }. r  K! f+ H" J
  23. */
    9 ^! o! ^6 n9 w- E9 @

  24. ) I, }$ i0 J" C/ h! N1 }
  25. #include <linux/module.h>) v' W' a+ q6 G: Y( ?8 U* P/ @
  26. #include <linux/init.h>
    $ W) z) v# V7 n/ g
  27. #include <linux/errno.h>
    9 _( G% i1 V# w+ z1 G" t% [: X
  28. #include <linux/types.h>
    - p* ]9 p( O) K6 K
  29. #include <linux/interrupt.h>
    7 @4 M- e  V  y4 I
  30. #include <asm/io.h>
    7 |1 e. B5 `3 P) d
  31. #include <linux/moduleparam.h>2 k. R2 _0 s+ ^$ B$ u
  32. #include <linux/sysctl.h>
    + M1 H0 @0 l* G. v
  33. #include <linux/mm.h>( Q( r3 |" C  j  x! l8 K( z% R% A
  34. #include <linux/dma-mapping.h>
    / a& K% w" a! A/ H6 h5 P

  35. 0 t. T6 R4 y: w$ L2 l( l9 }
  36. #include <mach/memory.h>; w+ M+ C. q% V
  37. #include <mach/hardware.h># v3 o$ o& H0 l- n1 V
  38. #include <mach/irqs.h>1 v+ S" l8 O- o$ r% R
  39. #include <asm/hardware/edma.h>. y  T& i: Y% h% R
  40. " k" K  X, @/ n4 I; }5 S3 M
  41. #undef EDMA3_DEBUG
    : l) `3 w8 x7 z1 g
  42. /*#define EDMA3_DEBUG*/
    ( \/ C5 T4 Z3 I  U+ I
  43. ; l+ b  t7 j0 _+ L* x$ s- `
  44. #ifdef EDMA3_DEBUG
    5 B# I# e* H; l0 @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 h+ L3 F4 h8 d9 b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( W* ^& f. G. x$ O  K* g$ a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ @4 H# K0 c7 ?, S$ j( W/ D
  48. #else; c: f  k9 ^6 Q' T* _+ ^, H; d4 _
  49. #define DMA_PRINTK( x... )
    1 g6 E" G$ T& ?5 d
  50. #define DMA_FN_IN# n# {, I# A% Q) @2 z" Y
  51. #define DMA_FN_OUT
    2 d8 \  H/ T6 I0 C- H
  52. #endif* l* p7 f+ `+ q: U% v% R
  53. 4 I6 P8 s% m6 Q/ Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). X/ s$ U5 E* o) R4 N! {
  55. #define STATIC_SHIFT                3* u5 }) y5 y# v6 k. w+ f; D
  56. #define TCINTEN_SHIFT               20# A% y  u  D6 e
  57. #define ITCINTEN_SHIFT              21
    - C7 R& Z3 z; Y# F
  58. #define TCCHEN_SHIFT                22/ D+ j0 E7 v; d, q7 Z; ]% h* i; U
  59. #define ITCCHEN_SHIFT               23: y: W4 z7 }9 y
  60. * B% a0 Q! w. d! q2 f8 r8 j3 Q! R
  61. static volatile int irqraised1 = 0;
    7 p1 b( \1 |% G% H
  62. static volatile int irqraised2 = 0;; b( |5 [5 m6 ]3 z& M# ~/ _3 V" d

  63. : c9 i/ w  Y! W; ^$ h" u9 Q9 @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / V8 a, P8 n$ |& e+ e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, n, K$ F7 W( Y8 w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 G2 U( ~( A9 _* o+ `. n

  67. # w) W" h# a* s" M; }! [
  68. dma_addr_t dmaphyssrc1 = 0;
    0 K4 a+ v" l4 B7 s
  69. dma_addr_t dmaphyssrc2 = 0;/ W5 k7 T' t, r& x3 h
  70. dma_addr_t dmaphysdest1 = 0;6 @% M4 f6 @: h1 c
  71. dma_addr_t dmaphysdest2 = 0;0 p5 h; h- J5 Z7 a. J
  72. # f& C% q3 v, M8 {* j
  73. char *dmabufsrc1 = NULL;! p& O6 D8 e6 R  x2 S4 n5 M+ S
  74. char *dmabufsrc2 = NULL;
    & V  f9 m* C4 S
  75. char *dmabufdest1 = NULL;
    ! S+ x! {0 k8 r
  76. char *dmabufdest2 = NULL;
    : y! T) X# Z2 i% U  B) G4 G+ G) }

  77. * n2 d% E  _+ ^$ w) v
  78. static int acnt = 512;
    . K) `8 m$ M7 ?! |0 B
  79. static int bcnt = 8;
    5 c1 Q, X! p4 `8 K! T; s4 y0 B
  80. static int ccnt = 8;
    / g: Q; F4 Q/ V! C

  81. + J! n0 b, }. Z& Y+ Q/ \) w
  82. module_param(acnt, int, S_IRUGO);
    4 W7 y( B: W% j/ D5 f9 v! o: b
  83. module_param(bcnt, int, S_IRUGO);
    ( D% B8 B8 n  Q$ J1 Z% X3 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: T4 Q; E5 H3 L: |8 u. A' P
6 K& A  \9 C+ ], y) S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" Y" Q! ?- y5 r' a* \7 q* w. A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 x- f9 K5 C" o+ }( _3 Q$ d9 e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) c% h6 P  d3 M

/ c2 V6 m7 [$ S/ v; {) R8 y# z9 D# x4 u: f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-3 19:02 , Processed in 0.037606 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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