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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / }' m. V2 G$ }/ a7 V8 D6 ?! Z' O
  1. [code]EDMA sample test application
    ) x: K" o" @5 A% r. l2 E
  2. /** e. {! O9 l7 r' X4 F3 L6 B
  3. * edma_test.c
    0 L% ~) g6 e% n; S) p( q
  4. *
    ) L/ Z$ q& |4 G0 |! T. f
  5. * brief  EDMA3 Test Application7 R( S$ U; ~3 P& B
  6. *
    3 ^  ?% L+ p- q+ L
  7. *   This file contains EDMA3 Test code.% d: _: p( b% S; X" b, k
  8. *9 \* h% R) G& s9 @0 z$ U4 d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! ], Y% r) F5 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* R7 M4 i/ `' b; M+ H+ d
  11. *         TO CHANGE.
    . x  B9 t. n4 h- V; _
  12. *" j& c4 g1 N( O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - Z2 S* e" }8 i% _1 L
  14. *
    6 L0 Y& ]' R0 T( I+ `: ]( v
  15. * This program is free software; you can redistribute it and/or
    ! Q/ p; L5 I& J8 C+ k) b# n% @
  16. * modify it under the terms of the GNU General Public License as2 `# D1 T$ H# K  `" [+ ?0 ^
  17. * published by the Free Software Foundation version 2.' }) p" _) L9 Q7 U
  18. *
    : ]3 X9 W- |! w, V. d8 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. M! `( ]/ A4 A4 V
  20. * kind, whether express or implied; without even the implied warranty
    ; ~- e1 k1 [. h# k0 C$ a: k) J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 D3 X* @% i5 i
  22. * GNU General Public License for more details.
    ) F$ @9 _+ \6 `5 c8 v& U
  23. */
    7 i0 C8 m+ q4 }' d. \+ N+ {. i$ V1 R

  24. ; p5 @9 E) R# \& Y1 m
  25. #include <linux/module.h>+ x4 g/ c/ Z$ F3 ?
  26. #include <linux/init.h>
    / U  e. N# C, r
  27. #include <linux/errno.h>
      \, o8 i' `. z! t: }; _3 J' q2 f
  28. #include <linux/types.h>
    9 \0 X# s. }7 c
  29. #include <linux/interrupt.h>* h& G. k& X0 N$ w; Z# b
  30. #include <asm/io.h>
    . w3 W) Y. g' ?/ M( y
  31. #include <linux/moduleparam.h>
    9 c* W3 R: ]  e8 c; U& Y- v
  32. #include <linux/sysctl.h>
    : a; C0 n+ t1 L, z5 E3 i" w3 N
  33. #include <linux/mm.h>! f; j( m1 P' E. o3 W
  34. #include <linux/dma-mapping.h>
    ( T6 ?. Z! {8 T0 T' f9 S8 Y3 R
  35. 0 x1 H- n8 M" ?: I# z( k
  36. #include <mach/memory.h>
    6 @0 K. J1 n2 v# Q  F
  37. #include <mach/hardware.h>
    ) b: D; ]+ h2 O6 C  j
  38. #include <mach/irqs.h>8 D+ E/ b4 x2 c7 ]
  39. #include <asm/hardware/edma.h>3 i7 U, ?" B, t

  40. 6 j: U& y, `6 N
  41. #undef EDMA3_DEBUG/ p% S- G' x! k3 D$ y3 t; s# x
  42. /*#define EDMA3_DEBUG*/
    ! d, K9 G4 ?! m
  43. 2 ~( D* S/ Q0 D. [
  44. #ifdef EDMA3_DEBUG9 w7 |+ I2 }1 X4 f7 A5 Y) T* R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! N$ R8 ], q( f& S/ [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 Z6 `( }& t4 v, b* k! {  E; h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): _9 o% d- k0 E# |3 n/ Z9 d
  48. #else
    9 ^3 X" ^( l. o$ H
  49. #define DMA_PRINTK( x... )# j: f$ [3 [$ k  m$ d
  50. #define DMA_FN_IN
    % n0 c+ s  o" ?1 g# L
  51. #define DMA_FN_OUT
    % [" h- P0 x8 q* e3 l3 B& ^$ r
  52. #endif
    . ~# ~3 T; U" p; C2 T9 Z
  53. . P' p& T4 ]6 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& v) \# g2 j) i
  55. #define STATIC_SHIFT                3
    ' L/ K$ b. i, b8 d
  56. #define TCINTEN_SHIFT               20
    * i# t4 ]8 \- k' m' g* D) E. S
  57. #define ITCINTEN_SHIFT              21. I) K% q' h) |0 \: E& q1 S2 }" Z
  58. #define TCCHEN_SHIFT                22, y# X0 y. X' @3 s* a: Q
  59. #define ITCCHEN_SHIFT               239 b8 ~/ q& `# D; l, T
  60. / q1 T( u- ]/ s' c6 u9 D( T" D/ X
  61. static volatile int irqraised1 = 0;
    # z+ Y) c/ ]4 L$ ^  f* ]
  62. static volatile int irqraised2 = 0;
    . f6 W0 |9 |  n
  63. 5 e: m1 a" F2 \/ q1 E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 [. c4 g$ ?( D0 E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 P2 r4 y  z7 T# o9 L8 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 D: y: s' A7 O) N4 j, B! t

  67. 5 J5 m' M- r' J9 b# E1 o$ g- w% N# F
  68. dma_addr_t dmaphyssrc1 = 0;
    . Y( E8 Z" \% C  S* U) M: Q
  69. dma_addr_t dmaphyssrc2 = 0;
    + C. o3 F* s4 {6 A
  70. dma_addr_t dmaphysdest1 = 0;
    - o# v6 S: @9 F5 H$ w% R; r
  71. dma_addr_t dmaphysdest2 = 0;& \$ `. F" N' ]8 v( c0 O7 Z9 ]0 f

  72. 5 w' s5 {) Q) Q2 ~* E& j' W6 p( G
  73. char *dmabufsrc1 = NULL;
    7 v* y  N3 t, ?" z4 H5 {
  74. char *dmabufsrc2 = NULL;
    3 C5 ~3 F8 p9 p1 ^- W6 x6 S
  75. char *dmabufdest1 = NULL;
    ; l' h( B" T  \$ |, ~5 Y
  76. char *dmabufdest2 = NULL;
    2 a- h0 {( X8 W6 @
  77. + ?! l5 g1 U8 i+ O- O
  78. static int acnt = 512;
    ( W- t  o4 `4 _1 e; v* k) l
  79. static int bcnt = 8;
    ' x/ g8 C: T, r7 k2 n' c$ P
  80. static int ccnt = 8;
    . N5 E  o/ d- K4 r  K9 C2 V, b
  81. 0 W6 l  B( f) e% w- j' o
  82. module_param(acnt, int, S_IRUGO);
    6 n; @1 \+ @6 t7 i% h
  83. module_param(bcnt, int, S_IRUGO);( C' o" C( C+ o& f- \/ m3 }, r- l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 E2 R- I, ~! p/ S# p* k/ ?( ~
# s, ]" o' E9 L$ S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 g. g" ]2 ]+ ^: Q  p1 T9 }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" F9 V1 t+ f6 i% N5 N) @& e2 [     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 m2 J; N& z* ?+ e2 I' N/ H

, I; B/ Z" ^9 x* [( R" F  j- m+ C, @3 J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-26 05:43 , Processed in 0.039341 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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