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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 S$ I4 S2 K% _2 W  c8 C+ \$ j+ t: Y
  1. [code]EDMA sample test application
    2 u3 A6 x2 R) i( ?( J+ M
  2. /*
    0 Y# Y+ r5 r1 H! O$ F. G
  3. * edma_test.c
      [7 R$ c+ p! o6 M' x/ @
  4. *, b$ p$ {1 [! V" T4 G
  5. * brief  EDMA3 Test Application" U( F4 j7 C$ d
  6. *
    8 n. P% X% o% I1 s) e) \
  7. *   This file contains EDMA3 Test code.' \; J6 E' p/ o  h
  8. *
    * s0 J$ s* \* M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, w) R" v6 X- S3 f2 Y$ M$ I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: G- x9 ^/ N1 M
  11. *         TO CHANGE.
    - u+ r$ @6 Y) f2 G8 _
  12. *. w/ Q5 T1 c* R8 d3 G4 u& p- V! ]: @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 V) g# _9 k5 H* \! c! `
  14. *
    - |$ _  M' Z( h+ ?
  15. * This program is free software; you can redistribute it and/or
    2 W4 h: z1 }! q' l
  16. * modify it under the terms of the GNU General Public License as: M3 N, A6 ]$ @  T. u5 q3 l
  17. * published by the Free Software Foundation version 2.( v  _+ i2 _0 t1 h: S* g
  18. *4 F6 c8 u* X( ]3 c( _5 Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 e) g0 S5 [& D3 d
  20. * kind, whether express or implied; without even the implied warranty
    2 j6 g; f5 i+ v5 ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ v! T/ v5 b: n6 N' i
  22. * GNU General Public License for more details., B1 N! ?1 N" q
  23. */
    4 N7 a! b9 t7 Q, m  Y

  24. / x0 S7 [6 M  S5 ~% g* @0 x. v
  25. #include <linux/module.h>
    3 `+ o3 f) B) i/ ^+ o: Y8 t  q
  26. #include <linux/init.h>, V9 F) o8 D- |- G( W
  27. #include <linux/errno.h>/ j& d+ w# a6 ?7 ?
  28. #include <linux/types.h>3 Z7 f* h+ |  U8 y1 ~
  29. #include <linux/interrupt.h>3 i4 w0 O9 _# B' O8 P, K8 ^
  30. #include <asm/io.h>. w5 t; q( u8 D" [! W: ^
  31. #include <linux/moduleparam.h>
    3 h7 ?3 J% T4 p& Q, @- ^
  32. #include <linux/sysctl.h>) |% `4 t. [; B7 [9 G, w
  33. #include <linux/mm.h>
    - s9 R+ L/ O3 L( A" `( k6 \- @. _: J! d
  34. #include <linux/dma-mapping.h>$ m$ z4 l+ Q( G7 t# ?* `

  35. - c' V! b) ^# `+ g0 A- r
  36. #include <mach/memory.h>7 r: c% D- I" M9 u+ `
  37. #include <mach/hardware.h>; ^$ F9 k$ h( F9 P$ g& V$ U
  38. #include <mach/irqs.h>  o8 t& p/ I8 m" K
  39. #include <asm/hardware/edma.h>7 Q$ Y8 W* K" M9 a$ q# l5 u& r

  40. + b/ ~7 L+ ~+ U
  41. #undef EDMA3_DEBUG6 u% w$ z/ r/ B2 M# k
  42. /*#define EDMA3_DEBUG*/! K' {4 e4 \  u6 a; n! L5 E

  43. / @4 `* _8 a# D( _% |2 s. K7 [, S; E; U' }
  44. #ifdef EDMA3_DEBUG
    % M$ d: K& {5 W- {' G6 o! z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 q1 M4 N9 l* L$ s0 d( j" O( b. U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), w' A; \0 R% o; t! T3 U( ^3 B, Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# B" n5 N6 t8 C3 K& p5 e
  48. #else
    % O0 {6 B3 ~# D
  49. #define DMA_PRINTK( x... ): S! J" I; p6 X6 S4 P/ Q" Y9 p+ h
  50. #define DMA_FN_IN
    3 ~" {, y* [$ K) G/ p
  51. #define DMA_FN_OUT
    ) s# N' Y" J5 h. L! t
  52. #endif) j& G% X) r5 @2 D
  53. 9 ]- g+ f7 F2 W& q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# I# t$ ?2 m7 F4 p) n+ d$ C$ P
  55. #define STATIC_SHIFT                39 o* m4 S+ I. m3 T
  56. #define TCINTEN_SHIFT               20
    - D7 z- j' `: b4 B& {
  57. #define ITCINTEN_SHIFT              210 `1 r; x. O# x) k' F) }& R  X
  58. #define TCCHEN_SHIFT                22
    2 Y4 F5 w2 ~- k- E# F: v# j' B
  59. #define ITCCHEN_SHIFT               23! N$ Z1 i$ m9 \1 F( _! h" f

  60. . D7 g- Q" a% n$ B9 O$ c
  61. static volatile int irqraised1 = 0;. r, K( U( _% e1 F# x
  62. static volatile int irqraised2 = 0;6 @; x) X: J, U; Y: B

  63. % f) V9 ^# Q) b0 ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - ?* }) d2 W: }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 T3 s1 o5 S) K# F* t) `+ Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; I$ q$ J, |  j3 J  r
  67. 1 {7 t2 _' X/ Z+ I
  68. dma_addr_t dmaphyssrc1 = 0;6 ]0 P) c' Q' b
  69. dma_addr_t dmaphyssrc2 = 0;4 Q' P( `# r* @  S
  70. dma_addr_t dmaphysdest1 = 0;
    & j! h& @4 F  A1 E- E0 M
  71. dma_addr_t dmaphysdest2 = 0;" \' l1 f0 R& g3 R" l% `' t
  72. ) {& |4 |1 x" _6 \
  73. char *dmabufsrc1 = NULL;; L) s$ ~% s4 K0 e3 P
  74. char *dmabufsrc2 = NULL;
    : k7 _* r& D9 v* @; ^" C* |3 W
  75. char *dmabufdest1 = NULL;
    + ]* K6 G! `. ^! P, J- S
  76. char *dmabufdest2 = NULL;1 @% O9 B" `& V, |
  77. % j3 h) f7 k( K) W0 v% {
  78. static int acnt = 512;
      T9 t. z- F2 [9 Q# h" B9 C
  79. static int bcnt = 8;' @. |4 n; V, o- z+ E' w/ f
  80. static int ccnt = 8;
    9 t* F+ l0 E4 x/ {% d% ~
  81. 9 j8 P5 }( I& |
  82. module_param(acnt, int, S_IRUGO);7 j* i# w2 N) @4 M4 }9 v
  83. module_param(bcnt, int, S_IRUGO);5 G! m4 b5 o$ L' S* F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( l, A% M: D$ W% O, h0 ~$ w! R# O& _% W- W4 }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 a" d  k: ]* X' Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ X+ B, g# _  ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 r2 F9 |% Y. `* s7 Q( P: A$ L4 j& u2 N) [& e9 R( ]- Q& Z
; _- d  q# X9 ~2 U) L( ?$ T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 01:12 , Processed in 0.040115 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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