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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 J' W9 W8 l5 {; l
  1. [code]EDMA sample test application
    ! J( M. @8 L( l9 k! E& _3 w8 G9 R
  2. /*
    6 N! |# F% l+ _, [) b6 w2 J* ?* T
  3. * edma_test.c7 e2 i: B' g/ D! o5 c
  4. *
    / U7 R5 U) x% e0 ]2 e
  5. * brief  EDMA3 Test Application
    : z7 A2 k) T. O% a" X& ]6 g$ k0 w
  6. *
    : X. [- J5 X4 n4 f6 e- k# I- u
  7. *   This file contains EDMA3 Test code.+ g( e9 T  ?# b9 k5 {( i1 {9 c& @
  8. *- C8 n! ?5 n8 S, n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. @4 U0 W# ]. Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- m1 L! U9 D1 {( p) ?  ~) o$ m" Z# E
  11. *         TO CHANGE.4 m/ X8 A5 w! z4 c3 S2 s
  12. *
    3 G, J6 z: l; n+ C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, U* I% S6 ?- a+ L
  14. *
    * ?/ f: E6 F  l
  15. * This program is free software; you can redistribute it and/or; F* P2 n. _/ `1 b, q9 Q
  16. * modify it under the terms of the GNU General Public License as
    6 v2 j; g/ T( \" K$ t
  17. * published by the Free Software Foundation version 2.' f: C% K9 Y9 |0 v8 F5 m, `
  18. *5 h: U; g  r8 H  R! d: U/ p7 `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, {) ~3 B, H# P% a
  20. * kind, whether express or implied; without even the implied warranty
    5 P0 w" A) b: B+ _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' L6 A+ Q2 K: W$ I, d* ]
  22. * GNU General Public License for more details.
    2 e, L2 t  k5 e5 L8 S* k
  23. */( z, U0 z2 S1 C+ W$ w

  24. & C. I3 Q- ^8 R' T/ T9 }
  25. #include <linux/module.h>4 u2 }$ @1 S0 ]; c3 U
  26. #include <linux/init.h>7 T% a. h+ U+ e! }; {  n; t! I
  27. #include <linux/errno.h>7 d0 W2 n! A) H* c
  28. #include <linux/types.h>5 ~* L! [$ E1 e8 R( ]8 h0 P
  29. #include <linux/interrupt.h>- ]$ H1 r  [1 _6 n! Q# Q' g
  30. #include <asm/io.h>
    9 q% A: O8 K. e: y
  31. #include <linux/moduleparam.h>2 Z1 ?7 s  [* p' P; K5 D1 d
  32. #include <linux/sysctl.h>
    0 c. k( T, ^% K0 d1 E7 b
  33. #include <linux/mm.h>
    + {2 ?5 z: K* M" ?0 L
  34. #include <linux/dma-mapping.h>
    2 N# ~5 {6 B9 }' `+ y+ I- W% N
  35. ' {/ v0 |9 u. u. z
  36. #include <mach/memory.h># \  K0 e1 w: _* w+ x8 s
  37. #include <mach/hardware.h>
    % k' n9 Z- l2 B2 n6 E& f
  38. #include <mach/irqs.h>
    0 V) y9 p' F0 I: s5 D3 [9 ~+ [
  39. #include <asm/hardware/edma.h>
    : a& ]4 A+ T$ z  K
  40. " X% x& ~& f! j* k% s" O6 Y
  41. #undef EDMA3_DEBUG
    . ^& \1 e( p9 _/ W
  42. /*#define EDMA3_DEBUG*/7 D/ X# l( k* Z& B2 @8 Y; a: y

  43. ( x4 H' Z0 D; `4 E2 J
  44. #ifdef EDMA3_DEBUG$ h% E5 A7 ~0 ^9 a' t* o7 C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" t+ K% Y' d( v+ Z4 B9 Q. r) I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ U6 B$ I+ Z# y* |. s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 j$ u! g: t* q& V: I
  48. #else
    4 I8 H' q% U4 `& X9 l+ z
  49. #define DMA_PRINTK( x... )% a4 O1 j1 o- Z5 c+ n5 j
  50. #define DMA_FN_IN
    ( d1 q1 K$ T* M% i8 A: z7 R7 O
  51. #define DMA_FN_OUT
    ; m1 K, z2 Y1 }! @& [) n/ o; U8 J, F
  52. #endif5 d/ t0 U4 |- w4 _5 P
  53. 6 o3 x( Y( k1 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 A  k% U$ B; X
  55. #define STATIC_SHIFT                3! \0 z' N8 {. U
  56. #define TCINTEN_SHIFT               20
    # ~( t% d3 ]4 x5 H. ~, s$ E: s
  57. #define ITCINTEN_SHIFT              21
    4 p/ g0 |8 }; p5 I+ l, W3 I" o
  58. #define TCCHEN_SHIFT                22! g9 U3 {: b' p
  59. #define ITCCHEN_SHIFT               23, z+ u" m7 M' F4 b) o; E% n, t
  60. & V" n; m  l3 M
  61. static volatile int irqraised1 = 0;
    . q1 r# R/ v* _
  62. static volatile int irqraised2 = 0;
    , G0 G& a- H0 M  q  ?. C+ Q. n( `
  63. " a: h% @3 Q$ e/ ^8 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* t9 r2 T5 n! A4 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , p- a& ]3 q8 ^- ?+ x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 a* v* s2 s) z) b( ~) q3 V+ ^

  67. # J) z7 O6 j6 u! f, @  r! V
  68. dma_addr_t dmaphyssrc1 = 0;. m. U- d. L! k1 X4 d
  69. dma_addr_t dmaphyssrc2 = 0;
    ! E8 A/ A* ^& D6 ~; }* X
  70. dma_addr_t dmaphysdest1 = 0;
    2 \* U  I0 a8 G. R* m, n
  71. dma_addr_t dmaphysdest2 = 0;
    ) X+ A# a* R, R; e
  72. 1 Q2 Y  h/ q. t2 w* \% X' H
  73. char *dmabufsrc1 = NULL;) `$ b/ [; M$ x3 ~4 }6 V
  74. char *dmabufsrc2 = NULL;! }. N( y9 c6 x5 I, a4 i
  75. char *dmabufdest1 = NULL;7 \9 C3 {% S& U
  76. char *dmabufdest2 = NULL;% [2 p5 W& D$ Y1 K0 o+ b
  77.   B7 e" t& e, X8 U9 Z' V! P9 J( |8 X
  78. static int acnt = 512;- O" Q# }- i+ h5 N# `
  79. static int bcnt = 8;
    ; w9 Q) z& [/ {9 l. W0 `
  80. static int ccnt = 8;1 o6 M- f5 m$ g6 N! ^6 @
  81. & _$ c. ^* I7 n6 A  `1 y9 D
  82. module_param(acnt, int, S_IRUGO);
    9 B6 y; s, _: f0 D  s! i
  83. module_param(bcnt, int, S_IRUGO);# Z9 @9 a0 K7 |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) F  _3 w* _1 E5 u' a0 b

' W7 A2 ^1 d; O$ ]" `  r- @8 e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" Z# e2 U2 O, D& m+ o* M5 a: u4 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 s# h! P, }: f! @! R; I9 `- R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 V0 i: c! k$ R2 r+ i
0 _# t5 c# q* X$ s, _+ Z2 x: M0 _% ]1 R' M. I( W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-6 06:57 , Processed in 0.041419 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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