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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - j5 U0 V! }& F& Q4 y
  1. [code]EDMA sample test application  P' V" j; A. P: o
  2. /*
    , q: y4 s& U' x
  3. * edma_test.c) K2 D0 J6 j3 p& \) G
  4. *  O" }% L3 ~! d; b
  5. * brief  EDMA3 Test Application
    5 G! k5 J& U: N& [6 Z) u
  6. *0 j( W3 p* @* G7 S3 Z
  7. *   This file contains EDMA3 Test code.
    6 Y( C$ O) b# X5 ~# N- I
  8. *
    / g) S, x0 O+ c: u% Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 [2 m5 {  J1 v/ l  ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 d: [/ `) a' ~7 `1 n5 |# ~) z
  11. *         TO CHANGE.2 u9 j, V2 K6 x$ H+ H* V
  12. *
    " N, C8 Q& n9 J* y. y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; K/ s9 N! h% s% L: g; f$ G$ g
  14. *' O7 R% O- I2 l( K, H: g
  15. * This program is free software; you can redistribute it and/or. T6 H# ~: D+ c
  16. * modify it under the terms of the GNU General Public License as6 L2 O, K7 U$ z7 h1 v5 f( _$ F- q
  17. * published by the Free Software Foundation version 2.
    ' K( O, A' O" J0 i9 P- `
  18. *
    ! o5 s/ ]# c4 T$ k( s7 M5 |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. Z6 S, E' l! {, |
  20. * kind, whether express or implied; without even the implied warranty
    3 \# o3 {6 l# n2 }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; K5 Q, s; N. u; O+ b9 j6 {3 t6 o
  22. * GNU General Public License for more details.8 M. G! y3 j6 z# ]
  23. */
    , Q6 Z" N( P* K$ R( `7 _& U$ L

  24. 1 c+ O  h/ O+ x) M: e) Y- a3 E
  25. #include <linux/module.h>
      ~* Y% J4 |2 H4 d2 @6 l$ E( e
  26. #include <linux/init.h>. e0 N+ K; x) s
  27. #include <linux/errno.h>
    9 x0 I. M& _; K' P
  28. #include <linux/types.h>7 `- ~& y0 N0 L+ @6 m
  29. #include <linux/interrupt.h>9 l/ ^1 |' w$ c, a. |
  30. #include <asm/io.h>4 m: ]6 k1 Z4 y# w& q$ J
  31. #include <linux/moduleparam.h>$ m7 H2 X: g, G. z
  32. #include <linux/sysctl.h>, P3 `8 [* C9 z8 p% f) H- V
  33. #include <linux/mm.h>
    $ u% u( n$ Y, M( q1 h% u& Q
  34. #include <linux/dma-mapping.h>) I. H7 {( C9 b+ p* Z
  35. 3 L6 A# P  I( U8 q' `
  36. #include <mach/memory.h>: x4 X  \% U7 x  \! d0 Z9 n, H
  37. #include <mach/hardware.h>" M6 o+ }9 v5 h( i/ k3 H) T
  38. #include <mach/irqs.h>
    ! p0 v9 Y( K( @: {1 f0 I& ~2 R6 P
  39. #include <asm/hardware/edma.h>
    ' O/ t* z0 I+ U5 e5 N1 g. O
  40. + }, N5 y! @! {
  41. #undef EDMA3_DEBUG* a  ?, {, k: o; n
  42. /*#define EDMA3_DEBUG*/8 V# o$ ~% Y: N2 R- H

  43. , S* v0 w" f* R
  44. #ifdef EDMA3_DEBUG1 Y. r( |7 e4 A6 u  i" X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  ]/ A: q9 _5 s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( l% W1 e" A7 a2 [1 ]  T' H0 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 S& q* P5 q: p1 S: B
  48. #else
    6 C; {- q% c: o" _0 Z* b; @9 Y( u
  49. #define DMA_PRINTK( x... )$ j% H9 Z$ N3 q; f4 z8 Y
  50. #define DMA_FN_IN
    # W& [3 w& e, R2 |2 J6 k( `$ n
  51. #define DMA_FN_OUT# D6 l! j) t/ D' s/ U
  52. #endif
    * _. J7 h# V& J8 s

  53. / a  P, ^, |9 B9 b$ h3 ^9 t- |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 T" j8 i. ^! E
  55. #define STATIC_SHIFT                3% t, G6 p+ A! T! e$ J' C  s2 I
  56. #define TCINTEN_SHIFT               20- }$ y6 T7 K. M4 n0 T# A
  57. #define ITCINTEN_SHIFT              21% x8 R4 n. w" b, Z7 q( x% S: }* E
  58. #define TCCHEN_SHIFT                22+ `  s1 I' d9 D6 z; z
  59. #define ITCCHEN_SHIFT               23
    , i3 L7 `6 s( ?; N

  60. 8 N/ u3 n7 J% z4 e5 C  W: `
  61. static volatile int irqraised1 = 0;
    0 k  n9 l$ E. n' H# N
  62. static volatile int irqraised2 = 0;8 y% {+ K2 X2 I6 n) v, O3 B6 A

  63. . C9 i; o+ _$ o& v" U9 Z$ ?7 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- p( {6 {* ~: C3 Y# P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ C. p/ e1 N/ P4 F* j( R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; _1 j+ |; ?9 j6 ~7 }
  67. / {' }8 O/ @) m
  68. dma_addr_t dmaphyssrc1 = 0;" O! d4 Z1 v( K2 K# Q
  69. dma_addr_t dmaphyssrc2 = 0;
    - o& D$ S% [( {+ d- W
  70. dma_addr_t dmaphysdest1 = 0;* G$ s+ \. ]. z9 b
  71. dma_addr_t dmaphysdest2 = 0;
      c8 p8 w8 N2 r" {" R3 y
  72. % W# r# F% I1 v4 d  d
  73. char *dmabufsrc1 = NULL;4 n, K9 z; G( S7 m: ^% w$ Q
  74. char *dmabufsrc2 = NULL;
    0 G, I' {: v) M) j6 P
  75. char *dmabufdest1 = NULL;
    6 b; @) Q2 L: ]4 W) h$ f
  76. char *dmabufdest2 = NULL;. U3 P* l  t5 }+ {+ m

  77. , M/ I6 R! G, i# N( u3 A8 B
  78. static int acnt = 512;' ]( K$ }$ R2 ^. I, q. U
  79. static int bcnt = 8;
    / J6 H7 t# K6 a5 W6 a
  80. static int ccnt = 8;
    + q+ X  x1 r  [( I$ t! Q+ I, Y5 b* w
  81. + E9 w* T+ }: G! g! t" v& o
  82. module_param(acnt, int, S_IRUGO);
    - k3 {; M" z# b( `3 W
  83. module_param(bcnt, int, S_IRUGO);5 A% x4 N# E/ X  |! j# f( l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* }. P; [$ O; z

. S* q5 o; i0 R, F4 P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& [" m; [9 j* {2 ]1 J4 {/ Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 ^- X1 a% o! K
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% ]- W: h1 N% [5 @* ]6 T# B

  g6 {  i* [" S# v6 [1 T7 Q
3 C2 [' a; {* H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 02:42 , Processed in 0.038463 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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