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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, }2 r+ F( u; z4 Y- S
  1. [code]EDMA sample test application( z, C- [" Z8 h  K/ N7 F
  2. /*% K$ B8 ~* ^! A4 }0 A5 _
  3. * edma_test.c# S! @4 F9 t' r" C" t. ?" [% k
  4. *
    7 n5 F& ~; e" Y! i5 O* D
  5. * brief  EDMA3 Test Application8 U  a: U4 G8 U+ D6 ~' B% {
  6. *
    * }. X! A, d% I& i8 D
  7. *   This file contains EDMA3 Test code.8 O6 b; W1 {& ?1 O3 c
  8. *
    9 ^( B# v3 z& B+ Q, z' I# @  K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % C, L# o2 @, L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : T; I5 `8 r$ b
  11. *         TO CHANGE.
    8 W; Q) e0 J3 \9 a$ q
  12. *% c1 e! W3 e8 r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 l& V$ A9 S0 n7 X8 ~
  14. *9 \# n' V" v. l5 Y' C
  15. * This program is free software; you can redistribute it and/or
    : [7 R, ~# w" t* z2 J/ J" i
  16. * modify it under the terms of the GNU General Public License as
    ' i# q# f  F4 e! z* w0 q' a
  17. * published by the Free Software Foundation version 2.
    / X4 ]9 t) y9 [
  18. *
    2 v( v% ]  b) L# T/ M% _' M% E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 z  N/ A( Y' F" Z- X
  20. * kind, whether express or implied; without even the implied warranty" w. a; }) o, {: n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 F5 T" o) p+ t
  22. * GNU General Public License for more details.% Z! {  d# j* R0 y9 |- F7 ]! `- T9 `
  23. */
    7 H! m: R. o. @6 E
  24. # U9 h8 p; w$ |5 e& Y" d4 T- i1 y1 S
  25. #include <linux/module.h>, d4 i; D' H' L0 N+ p
  26. #include <linux/init.h>6 m# t* r9 c5 t# v6 [3 L% m3 @
  27. #include <linux/errno.h>
    , a2 s1 |) f8 ^9 ~7 J
  28. #include <linux/types.h>! p8 f  I) W. q
  29. #include <linux/interrupt.h>
    : |$ K1 R3 Z) u
  30. #include <asm/io.h>
    * Z* D; D) y. z4 y# c. D7 v9 P
  31. #include <linux/moduleparam.h>
    5 p: T; c" I5 [; X: N2 x) [
  32. #include <linux/sysctl.h>% b  G! k% G, s! e& F# _5 ~2 ~
  33. #include <linux/mm.h>: J+ B( M9 T* }- \; X
  34. #include <linux/dma-mapping.h>
    0 [& |# u! R0 s# k6 _2 o
  35. # y# _* a8 _2 Z8 y2 \9 E
  36. #include <mach/memory.h>
    ( P1 w: |# _8 H
  37. #include <mach/hardware.h>9 @' X! q( A0 D3 ^) W7 U5 T4 H3 ]
  38. #include <mach/irqs.h>
    % J1 _1 T: L5 s0 p6 e6 g1 \& Y
  39. #include <asm/hardware/edma.h>
    0 b' S( ?( @9 f- u. ]

  40. 2 T  ?  m! Z) i/ q+ v( T* P- e
  41. #undef EDMA3_DEBUG/ C  T. C$ U6 {  x/ G* x1 B
  42. /*#define EDMA3_DEBUG*/- i' s0 B: c  G+ C

  43. 7 I) c6 `) O, D% \
  44. #ifdef EDMA3_DEBUG
    $ N8 T$ m$ [# }2 ^/ }  b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 V4 i% }$ l0 C% M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 {) t: r8 H3 n, m! `3 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ I* g$ [3 h6 p# T; F3 x
  48. #else0 O1 }- ]' j' f1 O0 d3 e& w
  49. #define DMA_PRINTK( x... )
    2 }! \+ X' @  L+ T3 l
  50. #define DMA_FN_IN% s$ ]$ a- U7 r9 L2 ]
  51. #define DMA_FN_OUT; k, j& l0 |, {
  52. #endif. m' L" S: U! W' C" t0 l
  53. $ G3 y' e7 \+ g# g- `6 O9 R! p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 R6 T% A/ W" T- W5 r2 n! k. b9 m
  55. #define STATIC_SHIFT                3# R' V/ T1 p0 C
  56. #define TCINTEN_SHIFT               20/ n9 `1 x5 X8 h- m/ c
  57. #define ITCINTEN_SHIFT              21
    $ S3 O3 b( E4 Q. C& e8 f6 H
  58. #define TCCHEN_SHIFT                22
    ; @- E, d- u! {
  59. #define ITCCHEN_SHIFT               23& p, C1 }/ C$ }7 f2 v0 \
  60. + X" E% f0 Y2 T) ?. T
  61. static volatile int irqraised1 = 0;$ w) B) z9 F! t8 ^
  62. static volatile int irqraised2 = 0;
    7 O# L9 `0 m, d( q" t$ J

  63. , v7 M- t' q. w2 Y  O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 z" N; o) O, f/ ^% ^' K# X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * X! F* C( V6 s# l0 `& q1 `& S0 `; v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 Y, @! p0 U: m' z' t# ~

  67. % T; u6 S$ L4 i( q8 |
  68. dma_addr_t dmaphyssrc1 = 0;
    9 r, \. Q! P& K9 w; l* C# a+ U
  69. dma_addr_t dmaphyssrc2 = 0;, k$ _0 W* N1 V5 c7 y6 T8 }/ g
  70. dma_addr_t dmaphysdest1 = 0;
    ' p5 ]0 q6 t& z' D6 \+ [0 @7 N
  71. dma_addr_t dmaphysdest2 = 0;* ^+ ]* j. J2 D5 G/ T6 T
  72. $ L. A% m8 h* M8 ]/ L
  73. char *dmabufsrc1 = NULL;$ Q+ y. C, x3 [9 \' B' z) y) E
  74. char *dmabufsrc2 = NULL;
    0 c5 l, Q3 y5 A9 e
  75. char *dmabufdest1 = NULL;
    $ r6 h- x9 j' j
  76. char *dmabufdest2 = NULL;0 v7 B+ {8 [! O3 F# M; j8 r( G
  77. , ~+ o" E8 I/ N4 x& X% m7 m' }
  78. static int acnt = 512;
    $ ]- Y/ f. @; I- O3 z
  79. static int bcnt = 8;
    1 ^& ^' `) [! F) g7 Y
  80. static int ccnt = 8;1 @. @) N1 G& ?( p, t& \# A

  81. - ]  n5 V& z8 s# D
  82. module_param(acnt, int, S_IRUGO);  g+ s0 v5 m/ p4 ?# \. W: \0 P
  83. module_param(bcnt, int, S_IRUGO);; a# O/ A1 w* t' P! K# U$ G! c8 r
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 @9 `' n- f$ @
+ n8 C% X" @3 B. f
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 p2 x) m! _* T) R. `- q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 B: l6 D7 \, i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 F( H7 i7 v3 g/ }& F* w. N

; _1 n, D7 b4 j! @$ L8 G
7 t, E, E/ H* m( u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 03:18 , Processed in 0.038442 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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