OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" ~5 I$ t' _( n" ], C# }
  1. [code]EDMA sample test application, P& B5 ^6 M( q/ f6 W' ?. {5 i
  2. /*
    ; E3 b. U- m! f$ A: i0 P
  3. * edma_test.c
    5 R7 p' ~3 I) f1 u3 G' Z
  4. *
    ( _) s" v! L  D; d0 x7 {
  5. * brief  EDMA3 Test Application; L4 \* A, e$ O
  6. *
    8 G9 l: d  H; N1 `
  7. *   This file contains EDMA3 Test code.1 U- w, ~; P( g) `2 V  o1 @
  8. */ L$ _: U8 [' a1 U9 A3 l7 S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 A. p& W  H  o7 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 H* U/ }9 t6 W- ]5 r, L
  11. *         TO CHANGE.
    4 [$ F) u6 |/ O5 a. B
  12. *
    ! r( R3 W% B- k, f$ t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' X8 h/ p+ e6 ]9 B! m5 J) {6 q3 c
  14. *+ C, Z* g* g0 k
  15. * This program is free software; you can redistribute it and/or  e  r8 q, ?; J  d- a. @. ?) C8 d
  16. * modify it under the terms of the GNU General Public License as
    : a+ o0 i/ {7 J" X. k
  17. * published by the Free Software Foundation version 2.
    0 N. o% I  \2 B: ~+ h
  18. *! \6 T; N; R2 S7 ~# n) ]  B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , d( z- l0 O4 F. X  U
  20. * kind, whether express or implied; without even the implied warranty
    9 J' }) ^+ s9 U" B6 i! \- `" `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' n5 I9 \- N+ p6 c
  22. * GNU General Public License for more details.* _. p4 l& ]( v2 ]) S2 K
  23. */
    4 a: b' @* i7 N. d# s

  24. - S# b: z2 X2 h* s4 m. Z
  25. #include <linux/module.h>, j, P, S% f# E: s" c; }  p
  26. #include <linux/init.h>
    3 b3 |* [. i; ]0 u3 L9 D% q
  27. #include <linux/errno.h>
    . t: B( @3 d, H- |  x
  28. #include <linux/types.h>
    : A) Z, v) n; [' @; ~4 s: X* d
  29. #include <linux/interrupt.h>$ E/ ]1 f' |4 a, K( _2 p6 X. B
  30. #include <asm/io.h>
    1 m" `0 n0 P1 m) K; z# y
  31. #include <linux/moduleparam.h>1 J' ]* q  p( I+ v
  32. #include <linux/sysctl.h>
    ' Q# Q/ D: @6 p) t/ F7 `
  33. #include <linux/mm.h>
    $ c& j, S/ [  a6 H% I0 V
  34. #include <linux/dma-mapping.h>
    : G) P. {  ]+ y4 @

  35. 1 n3 E9 K; O  y5 [( T6 l% l
  36. #include <mach/memory.h>- B2 A+ F* E& u. u# R+ V, t& a7 h
  37. #include <mach/hardware.h>! @# @5 \# [( _) H
  38. #include <mach/irqs.h>
    & n) ?9 g* I2 e
  39. #include <asm/hardware/edma.h>
    4 O0 r) Z: q2 I, g; c  E; S1 D

  40. 4 E, i7 u/ ^5 h2 A
  41. #undef EDMA3_DEBUG/ Z5 X" i0 x3 M0 W0 A
  42. /*#define EDMA3_DEBUG*/
    5 @0 u3 u; D  L' ^0 m( O5 R" S
  43.   ]5 j' h( B6 M: O) K
  44. #ifdef EDMA3_DEBUG( d- a9 R& g% r+ x6 ^1 U5 U& _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 h. v$ g" _# @$ V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ I! I1 i- }2 t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 x; |  o6 e' d
  48. #else; t' J. A2 }) T$ M/ {6 P
  49. #define DMA_PRINTK( x... )3 |- t* r9 X7 L# _" `. G4 A' l
  50. #define DMA_FN_IN/ k2 w% T, Q$ F" H- C9 U' l; b0 |
  51. #define DMA_FN_OUT
    / T+ ^  G% F" m
  52. #endif
    , e8 }  G3 Q1 Q! p

  53. : `! M- E8 w: e. N: O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 n7 E5 J# L7 N8 c, \
  55. #define STATIC_SHIFT                3
    / T! O8 V$ s) O2 h
  56. #define TCINTEN_SHIFT               201 x6 K$ f- r, n
  57. #define ITCINTEN_SHIFT              21- N# p7 g% S0 B* a: p; Z3 @
  58. #define TCCHEN_SHIFT                22
    $ _. T, G6 M: _' I5 z/ n8 r
  59. #define ITCCHEN_SHIFT               23% V+ Q+ l: d& r

  60. 4 o% D% Z% C) x  _4 B0 i) ^
  61. static volatile int irqraised1 = 0;$ f" i- _9 n; d+ i( Y/ j6 i
  62. static volatile int irqraised2 = 0;6 \5 F5 p" s# ]# d
  63. & {( T% I; `% d4 _9 G/ @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 c6 |1 `9 W: ]2 n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % L) g: |" _  v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 T  O- b% M) E% x& ?$ Q

  67. : v0 O% N( V- X7 d" W
  68. dma_addr_t dmaphyssrc1 = 0;
    . i( N; B5 O/ S( N
  69. dma_addr_t dmaphyssrc2 = 0;: @0 r% l# {1 T! Q# ^; U
  70. dma_addr_t dmaphysdest1 = 0;* @2 R1 Z8 u  D1 m
  71. dma_addr_t dmaphysdest2 = 0;6 ~' x- s1 E6 x4 o1 A2 n" P9 W- i
  72. 1 W" j+ m+ c% f5 A/ u
  73. char *dmabufsrc1 = NULL;
    + b2 e0 C" X  [# q7 S: _& o
  74. char *dmabufsrc2 = NULL;5 i' C& w* ]5 [7 ?
  75. char *dmabufdest1 = NULL;1 h( ~' w5 ]. j: f! A+ p! \& @/ n+ U
  76. char *dmabufdest2 = NULL;. w, M- Z* b. R# p* w$ X2 m, y

  77. 3 C8 o0 s8 N" T( k* \8 U
  78. static int acnt = 512;; s1 Q$ m' u6 {4 L) R4 N
  79. static int bcnt = 8;
    ' C; N, L  O  f' j; K- G
  80. static int ccnt = 8;
    2 M- A7 U/ A- d2 g/ f; k/ h
  81. . b8 F7 Z1 B& J$ d9 y
  82. module_param(acnt, int, S_IRUGO);
    3 Q) t0 ~1 O/ u, Z
  83. module_param(bcnt, int, S_IRUGO);# K/ |2 m0 |) F/ K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 e1 ~% ]9 @5 Z+ g3 Q; I
9 e# R$ s& m0 g$ j6 d6 |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% M6 I/ A( K2 b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& p  }+ V# t: j6 Z: e* q1 w* F) p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! n% }. @* p! g. |, ^
# F0 H5 A8 S7 Z. u  |6 B6 M4 {6 i4 i7 ?3 j/ x/ x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-1 09:39 , Processed in 0.037671 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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