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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 O9 n! \9 a/ H( O! L
  1. [code]EDMA sample test application* L- D, }. B, M# \' s( {; I7 n* Z
  2. /*
    6 d: \% V+ D8 _: l
  3. * edma_test.c
    # [/ b8 A* E2 O* T; R( @7 {
  4. *
    # y8 Q- |  E% f6 T
  5. * brief  EDMA3 Test Application
    , L; Z4 U& H( Q  Z% X1 h3 H% E8 D
  6. *9 A( {2 u  e0 O/ F0 A0 \
  7. *   This file contains EDMA3 Test code.; [* c6 R# M% [4 p! b
  8. *3 p* ^7 |1 P; g7 T* C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 J7 H7 u6 J' l3 C$ u, G! l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 P: s3 [; }: h. q* `
  11. *         TO CHANGE.
    4 f3 `: |1 J7 y2 f
  12. *
    : w. W! R  \( @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * I7 U: E  g" p  q) V0 @: v
  14. *
    $ k/ \/ n; N  Y: H7 H  d1 X
  15. * This program is free software; you can redistribute it and/or
    ! O0 x; Z2 e4 [3 V& U& b
  16. * modify it under the terms of the GNU General Public License as/ m+ g5 M2 D( K) C- k, |
  17. * published by the Free Software Foundation version 2.5 v. {0 v  {  Q, p
  18. *
    4 i" h0 E$ b) p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : f8 y# v! w: H1 Q: m2 P3 A
  20. * kind, whether express or implied; without even the implied warranty
    6 ~; A( z: F/ [# x7 N) V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# P( q  @' D, U: }" C# O; ]" O9 G8 ~
  22. * GNU General Public License for more details.# J- |- }8 G6 P, N/ x
  23. */
    4 l% G. X2 W& J5 p2 Z. Q0 |5 N1 t

  24. * Y* g9 @/ s+ \3 g  _# V8 |
  25. #include <linux/module.h>. q/ y. ^6 \4 M! W/ h
  26. #include <linux/init.h>& Y0 }$ ^# l2 _
  27. #include <linux/errno.h>  f7 ^3 R% P1 L' W6 f9 `% u' O
  28. #include <linux/types.h>
    2 C( d9 y" L7 H) R8 C
  29. #include <linux/interrupt.h>
    . M5 }: o. }7 Q8 f# w
  30. #include <asm/io.h>
    9 I9 t2 X* ~' D7 y$ I# ^8 [
  31. #include <linux/moduleparam.h>
    7 f; E" ^# P5 ]: b3 K" j+ m/ e
  32. #include <linux/sysctl.h>
    ( k9 e# z0 Y- [: }3 w
  33. #include <linux/mm.h>
    ) s# R% M/ X2 n3 g9 D
  34. #include <linux/dma-mapping.h>
      h- R8 F& u# d  L' V" B( @

  35. & J1 _! f/ K$ K! p/ a
  36. #include <mach/memory.h>
    # h1 r  i, t- J/ u! }: p7 R, M
  37. #include <mach/hardware.h>0 \, K6 X# g0 n2 W! @
  38. #include <mach/irqs.h>
    % H" s6 D0 ?* I5 Q
  39. #include <asm/hardware/edma.h>
    , A* v' k' h% S- b# C
  40. 3 x0 c. `- S: D( ^, _* t: y6 p9 R
  41. #undef EDMA3_DEBUG
    ; t1 T/ \9 j/ s$ e. u4 N0 O- F" ?
  42. /*#define EDMA3_DEBUG*// ?2 j* U' y- L, x

  43. : E& W3 Z# t" t6 `# V: G
  44. #ifdef EDMA3_DEBUG
    - W9 b' x( W/ X2 s* y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' L* s/ s& \  P8 ]6 J* a  B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 j4 P) S2 E+ W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 g. I" j0 W6 ?2 u/ ]! I9 X5 \
  48. #else
    , ]) H( J' H/ }
  49. #define DMA_PRINTK( x... )
    : }# Z2 }& ^2 H9 d
  50. #define DMA_FN_IN
    5 `8 M* \2 j- U; J  G6 g" P/ r$ [
  51. #define DMA_FN_OUT# G0 ?3 i5 x2 N( o4 r' i
  52. #endif4 M4 O$ s# p* T1 W4 P6 m
  53. % x5 Y$ h: p  c7 ?- S" B' L% s( W9 i1 p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), E" ~" X) r. O3 \8 A
  55. #define STATIC_SHIFT                3
    9 S% K+ z; m8 U" o
  56. #define TCINTEN_SHIFT               20' S$ n: c' r4 h  ]) G
  57. #define ITCINTEN_SHIFT              21
    9 O* u  V5 J+ h7 _5 D% e1 W
  58. #define TCCHEN_SHIFT                22
    6 s' Y- h2 ~+ G; R/ P
  59. #define ITCCHEN_SHIFT               23# r( L/ f; s( S2 r  h7 t: B/ l

  60.   W- g/ m' v2 K5 X; [" K6 M
  61. static volatile int irqraised1 = 0;  U8 j! H! e# d$ T# M
  62. static volatile int irqraised2 = 0;3 ^1 D2 d5 F) ?3 O: a& J7 K
  63. / x6 \0 O  c- X) X! I' l" w8 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Y5 Y* V6 j$ U$ b' a& R! w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 f! q8 N3 J$ b' `& n3 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & y$ P5 ^( h/ h$ A% r9 X0 P6 W, @

  67. 6 E% J1 B$ h' T
  68. dma_addr_t dmaphyssrc1 = 0;9 K' F/ A& ~, g; G5 Y2 s( o
  69. dma_addr_t dmaphyssrc2 = 0;" z2 i8 E( x  _5 ^
  70. dma_addr_t dmaphysdest1 = 0;
      k4 B8 f, f6 r6 b3 g4 C
  71. dma_addr_t dmaphysdest2 = 0;% B5 h$ F$ J9 J9 n" {& m  A+ R

  72. # }5 P6 m# ^5 M5 |/ b3 w
  73. char *dmabufsrc1 = NULL;
    ' m0 F9 P, j& i6 {- l: [7 h6 N
  74. char *dmabufsrc2 = NULL;
    . ^3 K* g! g( B
  75. char *dmabufdest1 = NULL;2 n& e% E% R" B& C+ Q3 w" H
  76. char *dmabufdest2 = NULL;
    * H1 A* R$ c2 ^5 w* @6 n
  77. . k/ D: v- `+ H$ m& x# F
  78. static int acnt = 512;4 `& n7 V3 T  v4 b8 `9 p
  79. static int bcnt = 8;$ B/ I2 a: N. c6 v) }+ a
  80. static int ccnt = 8;  l8 N' o+ k& a, d' ~, s2 a; N4 P

  81. ) w- Q0 ]- `" \% D* _
  82. module_param(acnt, int, S_IRUGO);
    3 w/ n' l6 C1 Y# l5 z$ L
  83. module_param(bcnt, int, S_IRUGO);. ]( K6 ]! A" u3 ]) \: E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( S& Q* y  g% F3 \3 g8 _& ^# o, ?: O* q) x# t5 T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, v+ k; D# R! `, f. X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 ~0 q9 ]) Z( b+ y8 a1 @# q+ D$ j
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" W7 f; y! O' h. `4 W9 T! _5 c

, ^% l8 g+ H9 }8 N# a0 v' o6 R
: E) b' ?( X# T1 v0 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-6 14:05 , Processed in 0.038401 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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