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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* K- \( U) \2 z& G1 W; d3 O
  1. [code]EDMA sample test application: p7 [, u9 N3 E3 B' M
  2. /*
    7 U. ^% `5 `6 n2 |7 }: W# `, M
  3. * edma_test.c: C, G+ _# Q/ y6 V
  4. *
    7 l3 ?/ w) u* h% A
  5. * brief  EDMA3 Test Application( s+ H7 N2 I  U0 X
  6. *7 e1 }& N3 u6 c: D( _
  7. *   This file contains EDMA3 Test code.
    9 d5 _' _/ n1 H$ F, N
  8. *
    - E9 f1 h  {+ g! }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: C" x3 A! E( ?/ X* D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) Q1 ]& S) l8 L3 [3 d
  11. *         TO CHANGE.3 q- ?  Y) @+ ^# s. D! F
  12. *
    ( v* Q8 S# M- u+ Q6 F; k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 b6 ?3 U! d) a9 v% k. o$ w. `
  14. *
    3 l4 j+ t% Y8 S& h
  15. * This program is free software; you can redistribute it and/or
    6 f4 d" h9 V7 v, \4 I
  16. * modify it under the terms of the GNU General Public License as( @$ R& X( f9 y
  17. * published by the Free Software Foundation version 2.
    . o5 e" P# t; R: J9 H: F
  18. *
    ) m8 m8 m/ M: a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( t% B" p/ H% Z
  20. * kind, whether express or implied; without even the implied warranty
    4 Q* [: k) Q5 a9 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # E" Y. ~  K- G
  22. * GNU General Public License for more details.
    9 P0 P/ X* W9 z1 T; w( [
  23. */9 f1 w+ v9 E0 _" C$ t8 b  x6 u: f) U$ M

  24. ( \8 w& X8 k7 S/ \  _6 a3 h
  25. #include <linux/module.h>+ d  _0 e! W9 P- p1 t
  26. #include <linux/init.h>
    1 k/ Y" g1 o/ i' h( [9 w
  27. #include <linux/errno.h>
    ) V5 \( a/ c# q9 ?$ w& K: p
  28. #include <linux/types.h>
    . c! Y) H) H& N! S- p+ N6 ^
  29. #include <linux/interrupt.h>. R4 ^; v+ k. I! A- K- [, K
  30. #include <asm/io.h>- w# J5 m4 X2 j7 o4 M: w* I
  31. #include <linux/moduleparam.h>4 m0 m; ~! q! d# e( ]0 Y
  32. #include <linux/sysctl.h>! k$ p9 F" P. [4 h
  33. #include <linux/mm.h>6 y3 l" e! E1 N
  34. #include <linux/dma-mapping.h>3 @1 S( T! K/ ?8 \& E- v
  35. + I0 B$ Y6 v9 g* D% R
  36. #include <mach/memory.h>7 }# _( O" B! T; P5 L4 o/ E
  37. #include <mach/hardware.h>8 W3 U# ^* U' n& ?
  38. #include <mach/irqs.h>
    0 Z( @. u5 B9 X+ N. D
  39. #include <asm/hardware/edma.h>
    . |9 Y. }7 z; \. k3 ^* W, I

  40. 5 l4 b4 X$ m! I
  41. #undef EDMA3_DEBUG6 T4 S8 L" O# ^  R6 ?
  42. /*#define EDMA3_DEBUG*/
    4 l( ?  v4 ^- \, L, J
  43. # ^$ F1 V! K+ h6 _
  44. #ifdef EDMA3_DEBUG
    5 ~4 l8 d5 O+ K5 i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& B. m2 e9 G; x  J( y. f& M4 Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # ?7 K4 A( D0 F4 \- B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& t- S; t+ r0 ^$ ^0 m$ ]
  48. #else
    * i! D6 X, `, K
  49. #define DMA_PRINTK( x... )7 p' ~- J" K: V  G- m1 z
  50. #define DMA_FN_IN
    2 d# ]  ~& j/ Z8 j
  51. #define DMA_FN_OUT
    ) t- Y/ ?( N$ K+ h! s2 {4 U: M
  52. #endif
    9 {) H. K% z7 ^. P
  53. ; U3 U2 |1 s$ s! K: v  j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( t6 |. J! N. J" p7 o
  55. #define STATIC_SHIFT                3# D) ^8 D6 ^! ^3 J: R
  56. #define TCINTEN_SHIFT               20. g3 U8 k" i1 b1 f7 \; V" l
  57. #define ITCINTEN_SHIFT              219 C+ S* x8 r6 |7 y+ x" `
  58. #define TCCHEN_SHIFT                22
    ; X2 G$ W& h4 g; w: V( X7 P
  59. #define ITCCHEN_SHIFT               23
    * l6 u4 [; b3 s* S0 F* b
  60. 9 m' U! Q$ ^. H* r: w
  61. static volatile int irqraised1 = 0;
    ! y; s' O* K& p8 b
  62. static volatile int irqraised2 = 0;
    ' \4 X" J- O6 p9 U
  63. ( D, t' M$ z* n: w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 d+ H+ T3 v; U* L! b1 O  E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. M# y% V) Q6 Z7 J- ^; ?' Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" V) K4 V& ~/ p6 d$ `- a" w
  67. 1 Y, _: g5 s7 p1 }& M
  68. dma_addr_t dmaphyssrc1 = 0;  q0 }% n" P) o  A, Q
  69. dma_addr_t dmaphyssrc2 = 0;
    . G, Y/ I7 X$ x) z
  70. dma_addr_t dmaphysdest1 = 0;
    % p7 t1 a7 z5 @
  71. dma_addr_t dmaphysdest2 = 0;2 [, b! b0 s0 c# I  i8 t* i
  72. 7 b+ J9 G7 S" l! y
  73. char *dmabufsrc1 = NULL;
    5 L- e+ o" `3 R% S6 e
  74. char *dmabufsrc2 = NULL;% c1 P. @5 d3 g) r
  75. char *dmabufdest1 = NULL;! i- ]4 s: j& y0 ~. U
  76. char *dmabufdest2 = NULL;
    / g+ o9 d. t5 {

  77. 2 V' A( Y# ]0 P  z: ]
  78. static int acnt = 512;
    / k$ O2 R! @& l
  79. static int bcnt = 8;
    8 {' T' s8 ^* z7 c8 J! t0 X
  80. static int ccnt = 8;. R  R0 B' n5 J

  81. ! ^9 @8 P% b6 {4 p
  82. module_param(acnt, int, S_IRUGO);8 R+ I& N/ ~, F; n/ U
  83. module_param(bcnt, int, S_IRUGO);2 W6 t; B0 \4 W+ d3 Y1 R  j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, v# F2 K' }5 d' l' K2 Q  x6 V4 ^& p2 w0 e8 {
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' f3 |- k# `6 [1 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ z' v' {0 L0 L( S3 ^5 r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 e4 s8 ~2 q) [" |4 y2 N

$ |- P' b, q  T# H$ G+ f' O4 N# P! Z1 [! w0 b# K. E+ w7 n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 22:56 , Processed in 0.040102 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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