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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - \6 J4 k1 [- v) j0 ^
  1. [code]EDMA sample test application
    ! Z' Y; Q" e# i! p
  2. /*, _0 e4 ~" Z! N5 r2 t1 d
  3. * edma_test.c
    0 m- y3 f( m, Y  |
  4. *
      c1 ?5 V0 {2 I7 g1 ]+ A
  5. * brief  EDMA3 Test Application/ }/ J# j) x* g6 l+ H7 R
  6. *
    - {* r  ^. F+ |1 _
  7. *   This file contains EDMA3 Test code.
    5 S0 \/ @# }; p( Q
  8. *
    . t% J% f0 G# i% I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ^2 J! P- {" @# a6 w% Z3 f3 _) n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 Z) g; J4 A4 R; r
  11. *         TO CHANGE.: v2 S) j$ p: Z7 m# C+ g
  12. *
    # B0 M7 S# [- }6 n# |4 l8 I+ |# [8 T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 b  t- `  B- U4 `/ X% L
  14. *
    / h7 U/ y( S, N; i
  15. * This program is free software; you can redistribute it and/or
    ' M4 X- r( N; W
  16. * modify it under the terms of the GNU General Public License as
    % M2 i, O/ o  k7 n* V' |2 Q
  17. * published by the Free Software Foundation version 2.
    1 L/ e, d% z, e) A+ J; z7 T
  18. *# c* [! @, j" Z/ }. |2 h. a# i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 t4 ^, u8 k4 o
  20. * kind, whether express or implied; without even the implied warranty' t' l3 |% ?$ k. {2 U# A2 l% W: Q, l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) x/ W8 |$ r5 I) [( _% F
  22. * GNU General Public License for more details.
    - |) M2 ]8 b4 n/ a$ a
  23. */6 y2 X* ^: W" u

  24. ( i0 d7 A1 ~: B& R  G1 g9 ^+ c
  25. #include <linux/module.h>
    / b9 B6 }( j+ `) `
  26. #include <linux/init.h>
    6 @0 P9 F/ z+ F6 R
  27. #include <linux/errno.h># A/ Y+ A: B5 {9 I* ^1 }
  28. #include <linux/types.h>9 p" Y% d( {, R0 K0 ^$ i! U
  29. #include <linux/interrupt.h>* @  U/ h3 E- U& j  T4 G2 Y
  30. #include <asm/io.h>
    + \: h0 f5 m& D+ c; V* @+ k
  31. #include <linux/moduleparam.h>3 N$ x- L; W( b- ~- a$ b" c
  32. #include <linux/sysctl.h>( p, S$ M  B6 H4 G* D% q
  33. #include <linux/mm.h>
    1 r  @! `0 w7 ~  c; E1 g9 e% |6 B
  34. #include <linux/dma-mapping.h>
    6 ]) L5 T4 D5 d. Z( \3 ?* F% R
  35. " E8 |2 J/ N8 g/ f
  36. #include <mach/memory.h>* h8 W$ v2 u0 l- w. p
  37. #include <mach/hardware.h>' U5 Y6 u; \2 i0 `) W1 ~2 U
  38. #include <mach/irqs.h>3 L2 t, ]5 S* O
  39. #include <asm/hardware/edma.h>
    ; r0 c# C. U( e/ `# o/ d+ b, J

  40. 6 H* F1 Z/ L# ~( l  [7 Y$ l
  41. #undef EDMA3_DEBUG9 Z2 W) M/ G$ N5 U) j
  42. /*#define EDMA3_DEBUG*/' C4 a2 a" q" q. _
  43. 7 G/ G1 \; L, C2 x: C- Z3 O
  44. #ifdef EDMA3_DEBUG& d1 V1 i; p) V1 X- O$ J! m5 G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 ]8 h- {+ w2 i8 o# v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" f+ k. j3 D% z- D# t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 R% t9 Y! B9 t, h3 z
  48. #else1 l& m# f9 H4 N5 Q" Y
  49. #define DMA_PRINTK( x... )
    ' O8 Y) ~5 v- V$ D* d( x4 ]3 [! p: I
  50. #define DMA_FN_IN/ P5 E2 D6 g; ~) O' Q3 ?! D* S! P. [0 O
  51. #define DMA_FN_OUT
    / D/ K, d! D( i, U7 Z, Q. X0 N
  52. #endif5 f/ W6 k; B( A: @: L4 z2 l& C

  53. 5 A; U! ^# f# U4 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * i+ L" v( }! R3 y- S  E/ ?. T% D
  55. #define STATIC_SHIFT                3
    4 f5 j7 I6 _, m
  56. #define TCINTEN_SHIFT               20
    # C  }* F2 K+ Z! i
  57. #define ITCINTEN_SHIFT              21
    6 q7 @5 A, d. ]$ L# t
  58. #define TCCHEN_SHIFT                22
    + Y- {, f+ ~3 E; z( M
  59. #define ITCCHEN_SHIFT               234 J% V, O! c" ^
  60. 0 {1 R' e: f- L7 R+ n
  61. static volatile int irqraised1 = 0;3 b" b1 h* M2 U/ o  \8 x) f
  62. static volatile int irqraised2 = 0;+ E' \+ s- F2 @# M+ A5 {% o2 o- Q1 x/ `

  63. # B$ {$ O+ }1 _" c) Z5 _5 Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( Y) X6 _7 d$ S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : Q; F/ E( ^; V5 x' @9 A9 D: {8 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 z2 M8 q' v6 X* p: P5 \% _1 ?2 l
  67. 0 J$ k/ Y5 m- N" N0 @8 M
  68. dma_addr_t dmaphyssrc1 = 0;
    # I; c4 |7 D% y# ?
  69. dma_addr_t dmaphyssrc2 = 0;
    " L& w, J; v7 }
  70. dma_addr_t dmaphysdest1 = 0;
    9 m  e+ \6 P( X% w+ h* C
  71. dma_addr_t dmaphysdest2 = 0;6 N+ u& M$ r2 n+ B
  72. ( I& M5 s) H+ B$ A& |
  73. char *dmabufsrc1 = NULL;
    % }: p" b& u, t* {9 L+ T
  74. char *dmabufsrc2 = NULL;+ Z, ?) H; E, j9 b3 X, v/ R
  75. char *dmabufdest1 = NULL;/ V$ ?1 F$ z* ~6 w2 H
  76. char *dmabufdest2 = NULL;5 Z  J5 R) G, Q  H# V4 [: n
  77. 1 `, q& C0 J' A% N
  78. static int acnt = 512;
    ) i; {! M- {- x1 Z9 J( i
  79. static int bcnt = 8;
    " k. ^9 t, s$ }3 J) p
  80. static int ccnt = 8;5 h. Z6 u6 z0 k6 K% q4 x
  81. / ~2 [5 N4 Z* E' f7 `
  82. module_param(acnt, int, S_IRUGO);7 {7 h" j! f+ J! h# @8 ]6 A; k
  83. module_param(bcnt, int, S_IRUGO);0 }4 F; A0 h0 U$ `. R: L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 Q+ b  ]  s4 ~% w3 I
; h. p+ j7 Z# u8 J5 Q" P; I' K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ ~  W8 \' m. `- @; o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ a: P2 u& L2 X) f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ W; i2 o9 _! m% X5 |6 k0 l# A, O" \3 v& z
* d: F: Z% G3 O0 t& ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-6 13:55 , Processed in 0.039390 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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