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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, T1 N# ^- k2 y7 |3 m
  1. [code]EDMA sample test application
    ( J0 ^1 S  t6 ?5 y
  2. /*- p. ~% q- E) w9 z; ^
  3. * edma_test.c
    ; P. C3 U# _' {- H$ c
  4. *+ x) P- W5 d" M
  5. * brief  EDMA3 Test Application7 [6 K* c# u( m2 {% A
  6. *
    - F2 G" B# W; o; ^9 \5 n# _3 d' f+ m
  7. *   This file contains EDMA3 Test code.3 L7 h/ X) f  x; `' v8 M3 A
  8. *! u2 E' a/ r& l8 Q, w4 J4 l# j9 G& y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' I& y) C( U) ~3 O& u. N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) S+ U! R7 T  J6 Y! b
  11. *         TO CHANGE.  C: F# D1 A; B+ s2 E3 ]8 ]% z  J1 u
  12. *' ]% R0 t: J: R. R) _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 U) C! z$ e, q9 i: {
  14. *6 W2 c$ h3 W* w6 P* d
  15. * This program is free software; you can redistribute it and/or# f5 _9 T/ U  i' d
  16. * modify it under the terms of the GNU General Public License as
    6 m, W: P+ S: \! \2 k
  17. * published by the Free Software Foundation version 2.
    9 G: G1 |# m6 X( W" b9 P% p3 F6 a, |
  18. *1 l. \) F6 l/ r$ T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : i  ^3 N! v3 s; ~1 l$ b' u
  20. * kind, whether express or implied; without even the implied warranty
    ) P% b* Z( x1 y6 r; u: g, E" S# k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 h- n  e5 K9 K( g
  22. * GNU General Public License for more details.
      M. b: T2 Q/ e! ^
  23. *// P+ T4 e- b+ S# z1 C4 \& n' ^
  24. + n" T4 B' j( o! W- H
  25. #include <linux/module.h>
    ( F0 e7 u+ s) o* M- e
  26. #include <linux/init.h>* d% P  L" d- O, t4 Z& T
  27. #include <linux/errno.h>
    9 {' x' k  F2 t: p* b; w
  28. #include <linux/types.h>5 P) f# J6 M& K0 R/ o' H9 ?6 _
  29. #include <linux/interrupt.h>
    + V. E) V6 w# r
  30. #include <asm/io.h>8 D, D; `; J3 u+ ~
  31. #include <linux/moduleparam.h>* h$ O- W) O# s$ ~) |
  32. #include <linux/sysctl.h>
    - w# n6 j& [& I
  33. #include <linux/mm.h>
    : e* L3 }$ I( D: p) i
  34. #include <linux/dma-mapping.h>5 W7 d- `+ a2 @: J( f0 V( f% t
  35. ) m: }. W# x: u& E1 ]
  36. #include <mach/memory.h>
    7 r' l- T: j6 D5 J" y" j
  37. #include <mach/hardware.h># G+ p5 u  j7 ?) L$ o  U
  38. #include <mach/irqs.h>
    3 [" M. `1 E. J" e2 G/ `( z9 T
  39. #include <asm/hardware/edma.h>
    - k5 U1 o: O8 w0 p/ E% p

  40. 2 l% z( F4 i+ y. {1 X; {3 ]7 X3 w
  41. #undef EDMA3_DEBUG; s9 i8 d- M3 _& G/ {( m' R5 W  Y4 A
  42. /*#define EDMA3_DEBUG*/( ]2 ~$ o% a, ^' a/ B; {3 |

  43. ( \- o/ ?8 G( g3 L+ X
  44. #ifdef EDMA3_DEBUG% C) U2 l6 b8 ^# _0 C, H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & d( I4 Q7 C5 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). H, @9 l  j# E, a4 M" h  x1 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 |6 y% W0 r& b4 G+ V6 p
  48. #else! G! W; t3 v7 F& ?  ?, S$ G9 h
  49. #define DMA_PRINTK( x... ). L, O" a$ V* V1 N! H) C
  50. #define DMA_FN_IN
    & h& H% z4 O0 J& K; R( ~8 o& @
  51. #define DMA_FN_OUT. }  l# c3 [* f7 \3 X
  52. #endif. E  o; [, \. G7 X
  53. * u  |8 u' r( Y6 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); Z; f2 m8 p" ?- D% X8 c
  55. #define STATIC_SHIFT                32 g8 G# z2 k2 M+ d9 Z
  56. #define TCINTEN_SHIFT               20
    4 r8 I5 \7 z% D) v, g* c
  57. #define ITCINTEN_SHIFT              215 t9 K/ n, n0 t8 ]4 P% `9 m. G
  58. #define TCCHEN_SHIFT                22
    2 U. Z. S( e/ i; b( r
  59. #define ITCCHEN_SHIFT               23
    7 B2 W  r: H7 x* c$ B; E
  60. , K7 ^# w  Q0 b+ h9 g: ?. e3 f
  61. static volatile int irqraised1 = 0;
    # L+ k$ O! ~) ^  o. K+ b8 g7 c
  62. static volatile int irqraised2 = 0;8 }0 k9 e  F2 v
  63. ; x  B/ F: q$ z! ^1 S+ {" _% W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 w* L  ?) I# W4 t/ }5 h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% L& I/ `. q0 S4 x; c: L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 x* x/ t' H. Z7 c0 A2 E
  67. / n4 F! Y' r& l9 ?) E
  68. dma_addr_t dmaphyssrc1 = 0;
    ' U& D5 [: W7 O, r
  69. dma_addr_t dmaphyssrc2 = 0;
    ; t# N2 Y' b2 b+ \
  70. dma_addr_t dmaphysdest1 = 0;
    , @: [4 J) g6 Y- [" o
  71. dma_addr_t dmaphysdest2 = 0;0 `- S$ \8 G, s% I0 b

  72. ( o- a. }* D9 U$ `2 I/ S2 ?! u
  73. char *dmabufsrc1 = NULL;
    - X8 h$ c* l% }/ w4 ~4 M* Z7 o4 e
  74. char *dmabufsrc2 = NULL;2 e% s& I+ B& I1 ]
  75. char *dmabufdest1 = NULL;2 d1 l' h6 w4 s2 y
  76. char *dmabufdest2 = NULL;2 K5 c$ i1 u$ g0 U: U6 Y  R8 y
  77. ( ~' h4 S% Q- F) Q& v  p- x6 x' v* P2 h
  78. static int acnt = 512;1 t. I: R% j5 |  _  j( i8 |' s% t
  79. static int bcnt = 8;) w9 N2 h8 L, x& h
  80. static int ccnt = 8;: _, B1 X4 U; R) _1 e) W* x/ m
  81. : a9 t7 H5 N3 _7 F& S
  82. module_param(acnt, int, S_IRUGO);5 W+ a+ v" M$ X. S3 j! P+ F
  83. module_param(bcnt, int, S_IRUGO);
    4 G9 l0 k$ Q4 Q% B7 }& L) R  }" Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  K1 {' G/ V: t( G  ]( r  q4 x, ?
& w) }+ t, c6 C2 s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: \) m) d/ Z# i+ q5 g: sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* y3 }+ S& I4 d' r4 U& Y7 c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" f# ^) w; G' l6 B
* t& N- t' S" Y3 c, U+ J
1 [# b) A3 N, K3 v% C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 08:28 , Processed in 0.038090 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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