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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( a, b1 p3 V% B7 I) t. d
  1. [code]EDMA sample test application  u( ?# b! H/ u# A! x8 H
  2. /*
    6 p& z# e7 z1 w2 B+ `
  3. * edma_test.c$ ~7 ~4 O0 f/ L5 K5 U" x
  4. *' x. |" z* s) |$ r
  5. * brief  EDMA3 Test Application
    + T! h3 D  t* T2 ]1 z$ X
  6. *9 Q! e9 i; n$ N; Q# k$ O( N' ?. e6 ]
  7. *   This file contains EDMA3 Test code.
    - P' t4 ~/ \6 v* E, y& l1 X3 m
  8. *
    & a# @1 u% G) z7 U; w- r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 W0 `; x) d; p0 C# y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 t0 m; D/ {3 C7 f. C5 t. z" f8 w
  11. *         TO CHANGE.9 d6 z$ U! Z  M! H
  12. *
    . [; M$ Z6 U" `( ^: u- |  J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      h* F0 i- X  y2 ~; P) }
  14. *1 Q& ~% F: G! k. h0 \3 l( l
  15. * This program is free software; you can redistribute it and/or" j  O; v% a3 C- G$ d. K  S0 P
  16. * modify it under the terms of the GNU General Public License as3 E5 |# F5 g& b
  17. * published by the Free Software Foundation version 2.
    / f) U" K! {/ e5 \8 d+ }8 E5 a
  18. *
    ' c0 d- p& H7 K$ Y, Z( y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 T6 Q( M  m( c* T0 B8 ^6 {) l
  20. * kind, whether express or implied; without even the implied warranty
    + `* U7 w6 S( L# {2 g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , e0 k* _: a0 b6 }/ J$ D
  22. * GNU General Public License for more details.. e6 U7 b! x: S- U
  23. */  b* X  T; |! ~
  24. . B: J( w. t: f! ~( B. l
  25. #include <linux/module.h>
    ' B7 k! z1 w3 I
  26. #include <linux/init.h>  D  a8 ^' ?$ V
  27. #include <linux/errno.h>
    9 p' B/ Q5 B0 ~1 g* W
  28. #include <linux/types.h>
    9 c% F- D+ b, _: @3 @6 I
  29. #include <linux/interrupt.h>7 a/ E7 C. P1 t3 [5 c$ O9 P! d
  30. #include <asm/io.h>& _0 x7 M4 F$ U
  31. #include <linux/moduleparam.h>7 m; k: ~3 ?" C8 q) D
  32. #include <linux/sysctl.h>( M. {% w) H1 E% t6 \7 C- P
  33. #include <linux/mm.h>
    5 [: ~' D3 B4 W) @# \3 n4 T2 K
  34. #include <linux/dma-mapping.h>
    7 V1 i/ I" K5 e6 O) I

  35. " c! K: Z6 B$ T  _
  36. #include <mach/memory.h>
    9 d1 L+ t, T2 j$ l1 ]' w
  37. #include <mach/hardware.h>
    5 ]  {7 ]- l# o! P3 D# P# d, h! b
  38. #include <mach/irqs.h>0 _. \) S' z  B
  39. #include <asm/hardware/edma.h>! b, ^1 k. d# {5 _
  40. 8 Q, N( @( Y" i
  41. #undef EDMA3_DEBUG$ V4 j5 d' l# b9 M6 s
  42. /*#define EDMA3_DEBUG*/5 C9 J8 r' ^% k( M5 c
  43. : r% o; k+ q4 L" _; p9 e8 R5 f/ ~5 Q6 M
  44. #ifdef EDMA3_DEBUG
      v9 W  [2 \5 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 x: z/ h8 h; q' n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , F+ U6 M; r4 v  A- U$ p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 U9 w0 x5 k# w9 o% J" u- p  X
  48. #else% k. T! C: s! C3 D& e( e
  49. #define DMA_PRINTK( x... )
    , P5 W) n/ {) l/ {$ X0 Z
  50. #define DMA_FN_IN) q; g# k0 p, C6 x
  51. #define DMA_FN_OUT
    8 a6 ]$ P: A, T8 a2 o7 D7 N0 m9 `
  52. #endif9 `6 u  B/ j7 x
  53. ! B- K3 D- S$ N: V5 w0 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 u0 d# D# l# I- [* a9 [
  55. #define STATIC_SHIFT                3$ g6 {$ ~1 N9 l* Y0 z  t/ S7 a# F
  56. #define TCINTEN_SHIFT               20
    : u% }  {2 d$ ~  w. R
  57. #define ITCINTEN_SHIFT              21
    5 v4 S6 h- h+ U
  58. #define TCCHEN_SHIFT                22
    9 M- {  K6 A; `; `' a, f
  59. #define ITCCHEN_SHIFT               23! T- m& V9 x- p

  60. ; N7 @. Z: Z5 z& T. d8 ~" A
  61. static volatile int irqraised1 = 0;8 Y. t6 g' h! g- a  R: \
  62. static volatile int irqraised2 = 0;
    % g5 n$ H+ o$ ^$ w
  63. # D( C7 _7 ]- [4 b5 ?6 _2 ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 s4 P. s: T- e" ~3 E3 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" u- I' K' v. b' v+ U9 f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : C: [0 v$ t+ x3 V2 v3 a: }

  67. . ~+ D' l4 p7 S+ y8 `1 E
  68. dma_addr_t dmaphyssrc1 = 0;
    ; [  B# b( L$ ^, A' S% |( V
  69. dma_addr_t dmaphyssrc2 = 0;
    : H8 B! T- K  o  ]6 f. T2 A
  70. dma_addr_t dmaphysdest1 = 0;6 E0 t9 [9 h: A+ ~& C; l$ o8 h9 i
  71. dma_addr_t dmaphysdest2 = 0;/ R! i% q8 _5 U+ d3 O7 s

  72. 2 L" F) Y% c4 [5 m
  73. char *dmabufsrc1 = NULL;
      W4 b3 Z* U8 D  K! y" r
  74. char *dmabufsrc2 = NULL;- D, M) S4 u5 x! R: m
  75. char *dmabufdest1 = NULL;) E( O3 I$ r5 x4 `% O5 U2 W0 W& h
  76. char *dmabufdest2 = NULL;5 I! ]2 k5 \1 G$ L

  77. 5 G' q, V  o- l/ G/ W
  78. static int acnt = 512;3 L. i8 C9 ^, N! c+ t+ z
  79. static int bcnt = 8;
    2 M3 W0 P- g0 b% {
  80. static int ccnt = 8;
    . k5 F8 ^2 C/ X4 X& ~4 e
  81. , A9 ?% o$ Y5 y- I% R; ~9 V2 D8 z
  82. module_param(acnt, int, S_IRUGO);
    3 D( ^9 e) E- I9 w( B' [% L2 z6 h5 y
  83. module_param(bcnt, int, S_IRUGO);) {: ^7 n9 S$ a3 z0 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% _' G! p; ?! p6 b( H& O: x6 H* J9 f" V+ U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% c  T+ E7 E3 g3 ]; Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 }4 X2 F# i% b( c3 i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; f3 [2 r" ^' }/ V- V$ v+ ^

4 V( R7 N+ D: n' o0 l$ m1 `  c: {6 @, l+ S" M+ Q" k( U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 21:47 , Processed in 0.040238 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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