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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# W# h, |6 n% e2 t9 H, s0 x! V
  1. [code]EDMA sample test application6 h7 l1 t, @, p( f" X
  2. /*+ f+ W( }0 d  s$ P
  3. * edma_test.c
      g' X( M- g3 V0 X: H: z! [
  4. *: ^' [. `) d+ N5 l' M/ E6 N4 h
  5. * brief  EDMA3 Test Application
    . U6 C: C% _% ^7 w* s
  6. *
    9 R0 }* ?  G5 z8 A/ X
  7. *   This file contains EDMA3 Test code.
    5 B8 _4 f$ a! J* O; J: C3 {
  8. *2 _5 |8 e" `  c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      Q, T3 c; C) [" S- x+ R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 J9 y! N1 c" N6 E  x; ^
  11. *         TO CHANGE.0 f: W$ p- k: y6 @* C1 e, z
  12. *1 U# d& M7 e- [/ \- D( G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 ~9 j9 S/ v& [! K1 Z: z
  14. *
    9 O" J& w4 U( |7 D1 L8 S) T& w# e
  15. * This program is free software; you can redistribute it and/or' L+ \+ v: u! h5 x
  16. * modify it under the terms of the GNU General Public License as" U0 \9 e1 ]4 Y7 ]9 q" ]1 Z. y5 f7 P0 h
  17. * published by the Free Software Foundation version 2.( k  z: T# O/ t  ~. P
  18. *
    , G  v. I0 U9 Y2 S" r9 \# e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 E/ h! E6 c4 T4 w/ m
  20. * kind, whether express or implied; without even the implied warranty, l4 `, G# ~+ V2 ?- X; _, W( e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' t7 `  A) u1 t. o
  22. * GNU General Public License for more details., d+ t2 S  @: |% |- H
  23. */. G7 Z" B7 P# ^& q" C& t( j! N
  24. % Q' m0 w( G+ X; t
  25. #include <linux/module.h>
    3 a8 p* l! u$ ]  |* Z, ^, f8 x( a
  26. #include <linux/init.h>
    1 ]7 }8 q8 A: n( L: q- M7 k, a
  27. #include <linux/errno.h>+ Z. Y1 h8 O2 K& y6 s
  28. #include <linux/types.h>
    ! E1 d1 Y' \- \1 y, [3 k1 j
  29. #include <linux/interrupt.h>
    ! N5 k& Y: I* o! U0 c- O/ S
  30. #include <asm/io.h>9 `/ D4 J  K/ M4 U$ T" F5 j
  31. #include <linux/moduleparam.h>0 A9 S1 K7 q# x+ ]3 Q2 K
  32. #include <linux/sysctl.h>
    : ^# Z+ L1 y' S, |+ Y' O2 T2 {+ `
  33. #include <linux/mm.h>
    " g7 i5 r$ z  b( U  @- [% y4 w
  34. #include <linux/dma-mapping.h>
    8 T* N  i* L" A
  35. ( K( l. }% w% f9 A
  36. #include <mach/memory.h>
    0 [) j* y, |; u" `, j+ \
  37. #include <mach/hardware.h>
    / O' }- t8 e, e. r# c6 U
  38. #include <mach/irqs.h>0 Y4 P9 v' f3 J* S0 g
  39. #include <asm/hardware/edma.h>
    $ X0 P: n# G4 t+ p1 Q3 O5 T1 ?
  40. 4 r0 M# S$ M3 h- L" h
  41. #undef EDMA3_DEBUG
    # O# }( x' D* Q3 Z0 f
  42. /*#define EDMA3_DEBUG*/
    $ c+ ]$ X3 N% ]% r; D/ ~
  43. + O# k: s* P) q% M! f2 G$ U
  44. #ifdef EDMA3_DEBUG& p; i7 W$ g& I2 d) O1 O! k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 o: [! Z* Y. n4 k: B. Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 G2 O1 I# Z8 @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) g& d$ K$ ^8 P4 q: ^; c4 i# {
  48. #else. I2 w+ M: `* V
  49. #define DMA_PRINTK( x... )
    1 G( N% U# [4 k) C5 O
  50. #define DMA_FN_IN. T, Q0 u  N1 |' M: v$ g7 J
  51. #define DMA_FN_OUT
    : H( {7 B; ]) v9 o9 k9 F
  52. #endif
    ; _9 M* ]1 a$ w8 U7 j

  53. 4 ^( w: T: g( J( P7 n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : w$ l* ^7 C6 A3 ~
  55. #define STATIC_SHIFT                3
    & b7 G8 m) U5 k" Z
  56. #define TCINTEN_SHIFT               20
    * V2 Y5 R/ i# Z+ P! k9 i
  57. #define ITCINTEN_SHIFT              216 `8 M' A+ k# s4 \
  58. #define TCCHEN_SHIFT                22# _0 [9 `0 ]" ^
  59. #define ITCCHEN_SHIFT               23- Y7 a5 I( }8 f, H- ]5 o, }
  60. ; P% V) y" i/ i8 [2 z: P* U
  61. static volatile int irqraised1 = 0;/ m6 t- m4 S2 r& j) V
  62. static volatile int irqraised2 = 0;/ {- a+ v5 i, I$ ^# m, Q

  63. 9 [5 c& Z1 K' R6 |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. x" E5 H/ |* U6 R5 }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 ^1 @& @' P5 d0 C/ h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  g- |4 o: B$ [$ j& j3 ^& e
  67. 0 [/ \9 k& B+ R5 s" H
  68. dma_addr_t dmaphyssrc1 = 0;
    : M& V6 S. ^/ p) E" l3 F
  69. dma_addr_t dmaphyssrc2 = 0;
    - R4 n+ J6 N, y# H
  70. dma_addr_t dmaphysdest1 = 0;# U) M& V; G# K3 t5 N& M/ I
  71. dma_addr_t dmaphysdest2 = 0;. m6 a. K5 x9 A' \8 j' N  L- t

  72. 2 O$ p. x" [) ?! c+ n
  73. char *dmabufsrc1 = NULL;& j) x8 q8 c( _4 B* v
  74. char *dmabufsrc2 = NULL;
    1 I) y0 E+ w, H
  75. char *dmabufdest1 = NULL;
    " j) d5 y# N3 A) \+ [5 J
  76. char *dmabufdest2 = NULL;
      ^! u1 s' d, G  y5 [

  77. $ V# U+ v. Z: v8 Z
  78. static int acnt = 512;) O! l& X7 Y6 |9 _0 W3 i7 H! y
  79. static int bcnt = 8;! J! L# q* @4 z: E' {- I' e: h9 V( d
  80. static int ccnt = 8;/ h9 L7 w) q2 s; M7 ]

  81. + i4 ~( z& y+ F2 F
  82. module_param(acnt, int, S_IRUGO);
    $ n, u8 w0 e* B: n0 v, H
  83. module_param(bcnt, int, S_IRUGO);
    & T) ^5 N. K! O! ?- R( k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* ]2 ?7 b/ Z; U$ R
+ Z+ d& L8 t2 z6 o! T! h; M  H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ j6 p+ g6 a' r( I, J& H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" w/ a7 J/ X0 W+ v: L5 Q; o% _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* v% o0 ]: \! A3 I
7 j3 R- @4 G: Q6 o

: e* W9 d: c# i7 e# a+ J% m0 ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 00:50 , Processed in 0.039112 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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