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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & y* g- l% H$ C5 B' z9 m5 @; u
  1. [code]EDMA sample test application3 R" I. j0 }$ _3 n7 |% H# V# S" g
  2. /*' y% C* x1 E4 c$ O: N, L( H
  3. * edma_test.c
    0 m  |$ W% |; k2 A7 M, y0 r
  4. *
    + L: q) J" |4 V
  5. * brief  EDMA3 Test Application
    . f) }4 o  d7 q# J5 p
  6. *
    - O/ [2 |8 w$ W- P6 w1 E& N7 k
  7. *   This file contains EDMA3 Test code.
    ; V! Z3 H% d* _- L! C' g* M% s& q+ H
  8. *
    ; I9 V+ J/ N0 n( s( r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( ~  m/ G; m2 V2 i. d( ^1 y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 d5 x" r" h0 F. r
  11. *         TO CHANGE.1 @  Y  Y9 P$ J" E/ m
  12. *& E6 O- a1 {, L, L( T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ K/ k/ a" j0 ~0 a% }2 J
  14. *
    5 p& t) K" W& R. j5 U
  15. * This program is free software; you can redistribute it and/or
    , k7 W9 L) A* ]
  16. * modify it under the terms of the GNU General Public License as
    & o; y2 ~4 m: Z/ B& u7 y, |% o/ _
  17. * published by the Free Software Foundation version 2.4 L# M$ L5 L* T4 _% g! Q3 h
  18. *
    8 E* n4 t+ v' S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 z+ q& L1 t* q( n/ |5 d* `
  20. * kind, whether express or implied; without even the implied warranty
    4 Y- G# ~. ?' x+ {0 Y+ b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( e! F6 g  x$ D0 [3 |8 m2 c
  22. * GNU General Public License for more details.
    6 ?5 l6 N9 p* S
  23. */
    . C% O1 R, c7 b  q+ |8 `4 D

  24. # c& A  u4 x7 B+ I
  25. #include <linux/module.h>
    1 j1 b4 k5 Z. l! t5 w# r
  26. #include <linux/init.h>  B: c$ _3 n% t  t% e1 {6 p
  27. #include <linux/errno.h>: }. ~% X1 o8 Y" E2 t4 H
  28. #include <linux/types.h>
    ! W; u8 h. W/ ^5 [4 {/ A# N
  29. #include <linux/interrupt.h>
    8 @" V/ N8 a! z8 `4 x
  30. #include <asm/io.h>
    0 ]8 Y: w2 G* c# [3 U
  31. #include <linux/moduleparam.h>( f  E; x; l) m6 e( W. V' U3 V
  32. #include <linux/sysctl.h>
    - A6 t$ X  y3 U* M6 k  N/ g! J
  33. #include <linux/mm.h>
    $ c8 O' Z( X" T/ Y
  34. #include <linux/dma-mapping.h>0 G2 C# `) H! f2 i" @
  35. 6 m3 t1 a( V( l/ A" ?$ j
  36. #include <mach/memory.h>
    / Q% t% d" C& j0 z2 T7 o
  37. #include <mach/hardware.h>1 c/ r0 W* |" |4 y( ^
  38. #include <mach/irqs.h>  k8 a2 [/ c" z* H# K
  39. #include <asm/hardware/edma.h>
    0 i4 q- N9 h8 H' Y* x1 B6 {
  40. " s2 F: T* c9 |' O; W  e% @
  41. #undef EDMA3_DEBUG
    , w7 X. ^8 I/ g# F% n
  42. /*#define EDMA3_DEBUG*/
      q7 Z4 S8 v- A% n
  43. # z' }  w0 M" Y& g( r
  44. #ifdef EDMA3_DEBUG
    8 v/ S" \, k0 e$ m& {0 M0 D: M7 ?. b4 b4 g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 f( H+ H0 j3 T* c7 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / U5 y6 x3 V$ e; A4 ^) {* p: E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) c/ q) d6 E8 O0 R* B$ H. I1 u, j
  48. #else/ \' E, F. ^$ x7 C
  49. #define DMA_PRINTK( x... )
    7 c. E+ m, Q+ X5 h9 O+ y
  50. #define DMA_FN_IN
    % q2 q/ H% i( `3 T- I- _5 D+ X
  51. #define DMA_FN_OUT, ~3 _9 h: @0 ^8 _6 D
  52. #endif* |7 ^; D7 h/ c5 ^6 I# m
  53. 0 B+ }# G: F( ?3 z2 u! g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; w$ b$ |( A2 ^
  55. #define STATIC_SHIFT                3- l& `  N( D- n; E
  56. #define TCINTEN_SHIFT               207 d; M6 z* o6 v# {9 H0 f/ J  d$ ?
  57. #define ITCINTEN_SHIFT              21
    3 m; K$ X6 D; W( J
  58. #define TCCHEN_SHIFT                22
    + ~( W) Y0 T, u0 ^" |
  59. #define ITCCHEN_SHIFT               23
    ' O) n$ \% q' ~4 r- B; ^

  60. 3 \6 F, a3 K& \% N7 n
  61. static volatile int irqraised1 = 0;
    % j: W: Z6 F9 k; b3 H5 G; r! V3 Z* [
  62. static volatile int irqraised2 = 0;
    0 `3 L* K/ P2 b  [" {
  63. 5 p6 g! j5 w: G2 O+ f9 A: @8 s6 V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  l% W* q5 b+ E( P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# [6 i; z) I6 k0 N$ R& _0 X& b7 G$ ~# ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ R" f- y+ I# ]( m. f" G

  67. 2 {4 a: h, k- S# {$ [
  68. dma_addr_t dmaphyssrc1 = 0;
    8 n9 y3 K. w. W" Y# r* j- O0 ~
  69. dma_addr_t dmaphyssrc2 = 0;
    1 q, ?* C% I7 p: m. w* R7 J
  70. dma_addr_t dmaphysdest1 = 0;- }3 {, ?9 k( {2 w: G
  71. dma_addr_t dmaphysdest2 = 0;
    ! h- B) F  }2 v9 ~; z) Y

  72. ; `( j. m: N0 ^/ w: k0 K. B# M
  73. char *dmabufsrc1 = NULL;/ Z# M9 y! O& z- i1 B
  74. char *dmabufsrc2 = NULL;3 [( @- V( a$ s0 l
  75. char *dmabufdest1 = NULL;4 h  X- N) R' o5 H; U; I: R
  76. char *dmabufdest2 = NULL;
    2 t  O5 D- b) W" [

  77. - X; ~( v- `3 Y& e5 {! c
  78. static int acnt = 512;
    ( R5 S' h# G' W; R4 P5 G3 J) n
  79. static int bcnt = 8;/ I, G6 l) I- \6 o- h; i7 \3 O' D& V2 b
  80. static int ccnt = 8;1 M9 d. i' L6 k, U% {+ H$ D

  81. : e5 q! C5 T. w
  82. module_param(acnt, int, S_IRUGO);- _# J: k- p3 d" Q
  83. module_param(bcnt, int, S_IRUGO);8 o! B8 i  ]- Q' @9 o. L+ C5 x6 `# ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. T8 @5 ?' _6 e

. J& ]! e0 ?, g0 E$ i0 q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 `0 P& ]3 u) m+ V8 r' ]0 T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" K9 w, S6 m: o! o& b1 J( G1 q4 s1 g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 B6 j, y1 W6 [! T, `3 `( F$ o
* h! \! K3 R2 A( K! q
9 L- S& @' l! V' G# X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 22:39 , Processed in 0.045736 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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