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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 {. q. L( P- Q" S8 {
  1. [code]EDMA sample test application
    . q& ?, G8 U, f) t6 F
  2. /*9 a' k: ^7 M8 a2 i, X4 g1 {
  3. * edma_test.c
    3 A$ `; p' u- k3 U4 z
  4. ** x% m1 Z. e5 j; R: T% f
  5. * brief  EDMA3 Test Application0 d6 h% [0 j0 B3 Y1 Q; a
  6. *
    2 z7 W9 j* U" E* J
  7. *   This file contains EDMA3 Test code.: F) v4 u0 ~0 H
  8. *, K6 f" E0 j( i6 J2 E# j4 q( z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 Z$ T4 }" S" C0 ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, J1 R6 t% h; B! k
  11. *         TO CHANGE.( m: |$ w1 S# p% b7 e( M4 Z
  12. *
    " s& P6 U' V, E( }% D" |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! n/ M$ a. r/ V" c% D
  14. *
    7 J' t! G- K) D4 {0 g; X
  15. * This program is free software; you can redistribute it and/or2 O% P- F: X2 k: A
  16. * modify it under the terms of the GNU General Public License as) C% Y  S5 I. [" M' j! L5 `
  17. * published by the Free Software Foundation version 2.1 U3 K/ h. b, h- [. j. T$ `/ ~- R
  18. *
    % ^, b$ q; T4 ]: K/ ~3 w4 q) F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. w/ u+ [. k$ a
  20. * kind, whether express or implied; without even the implied warranty$ {# R$ ^& Q8 R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 P( @  V5 k" l+ l
  22. * GNU General Public License for more details.
    * r# P9 J: t4 u3 g9 T
  23. */
    ( I& V. r  E/ }& R! J  ?
  24. + {: P6 [8 b" ?+ H& x8 K
  25. #include <linux/module.h>/ H& ?& v+ c1 l1 \8 g
  26. #include <linux/init.h>
    3 u0 d1 K) j* m4 W2 Z# K$ v
  27. #include <linux/errno.h>
    , p/ _. X9 P$ i( Y0 k' K
  28. #include <linux/types.h>0 f4 [3 S6 q& v7 y9 g
  29. #include <linux/interrupt.h>
    . d$ S% Y: i; w) L2 S
  30. #include <asm/io.h>! j  j4 X" q+ l5 M
  31. #include <linux/moduleparam.h>
    % y! C% Q5 }1 Z8 U+ J
  32. #include <linux/sysctl.h># b! b1 C; P8 h9 f% q
  33. #include <linux/mm.h>7 h* n  E" H& d* U/ \! c# f  n
  34. #include <linux/dma-mapping.h>
    ! Z4 S2 ^# |0 @+ Q4 o/ |+ S$ O
  35. ' z7 m$ ~( ]( l3 S; B& \
  36. #include <mach/memory.h>, q/ K5 a* ]: G( i8 v7 h3 f
  37. #include <mach/hardware.h>" [+ G( G2 N2 m4 n2 A
  38. #include <mach/irqs.h>
    $ D; o/ j  \; a5 j0 D/ _/ s
  39. #include <asm/hardware/edma.h>
    9 ?% t9 }. M; x* E; t
  40. " \/ b' b7 z% a4 o) K6 f5 }
  41. #undef EDMA3_DEBUG
    ! j& j0 w) r3 x2 g8 \
  42. /*#define EDMA3_DEBUG*/8 u" T: q3 r' W! D- D9 B

  43. $ s1 Y8 x4 \2 Z* z( k; V
  44. #ifdef EDMA3_DEBUG
    # W$ ?4 h! O! f9 w' l! I" D" ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " w) i' S- l& p) T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 \9 @, }; W; |) n9 p- ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 {2 o: t+ U2 U3 y3 z6 ?- g* s4 I
  48. #else
    ) n) z: Z% s1 b& Y
  49. #define DMA_PRINTK( x... )
    1 e, e0 B( y% ^# `3 c# S% B
  50. #define DMA_FN_IN- ]- U4 @) S4 T
  51. #define DMA_FN_OUT
    ' A$ T( x4 e7 V7 {3 ^  O7 ^3 L
  52. #endif
    ) z5 `& V. _$ O1 i  J  _
  53. # h. v5 A0 N: @1 R' B) Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 m- I+ d7 `* W: s6 T4 z
  55. #define STATIC_SHIFT                3
    ; N& {& {7 p$ ?9 ?
  56. #define TCINTEN_SHIFT               20
    ) `9 Z( z, K/ R2 B4 s! ]: E: m* R2 U
  57. #define ITCINTEN_SHIFT              21' Q& H5 `* O! o0 W* e7 Q6 n! w4 l5 t
  58. #define TCCHEN_SHIFT                22
    # b! Q5 y4 J8 P( ^2 S& Y0 e2 h
  59. #define ITCCHEN_SHIFT               23
    / E6 ?- G: _6 \& s( M) }

  60. 0 C9 K7 d% ?$ t1 J
  61. static volatile int irqraised1 = 0;
    9 |7 R8 M3 N! T8 _' F6 _
  62. static volatile int irqraised2 = 0;5 {5 u& Q" j! {  c8 r( n9 E4 v
  63. + E0 t9 e( g" v7 H8 C/ g; H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 D! h4 B3 @4 j0 J; j0 K1 S; P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 b# t+ d( f  l8 w2 T4 k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- {( D( T+ n( g* o9 y

  67. 9 C! ^/ u) i! P9 S
  68. dma_addr_t dmaphyssrc1 = 0;
    * T/ X& ~* {9 B& c6 x
  69. dma_addr_t dmaphyssrc2 = 0;6 L& P- z+ {; \# U
  70. dma_addr_t dmaphysdest1 = 0;8 e, m$ Q. g7 R  L+ V
  71. dma_addr_t dmaphysdest2 = 0;3 u0 s; y' w' P$ Q3 m# U
  72. % l# W0 W- C$ u# Y
  73. char *dmabufsrc1 = NULL;
    ( f# c5 S/ y+ n6 O
  74. char *dmabufsrc2 = NULL;
    1 N/ ~* f5 }. e7 V& @$ G! v
  75. char *dmabufdest1 = NULL;
    0 [9 p0 M9 W' e
  76. char *dmabufdest2 = NULL;. ^  @& Q, \( G5 v- m% ^
  77. / d3 \  A1 f# e) U8 |- v" ?& t5 Z
  78. static int acnt = 512;
    1 E/ j: t$ _9 B% A
  79. static int bcnt = 8;
    ' M' A5 c) r, f( [' E" _" Q
  80. static int ccnt = 8;2 h9 U# D# T% ~# ]" ~8 m2 Q

  81. 1 t3 M* h/ a3 U
  82. module_param(acnt, int, S_IRUGO);( B6 H9 `: f" z' O
  83. module_param(bcnt, int, S_IRUGO);( Z3 Q1 t; R& N) C% D, _( I4 q3 l$ N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- r! M$ `7 z( f( a( Z- L* Z* p, B
+ O3 p* r/ P0 e2 a# J  }: g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 `# j$ n5 F+ `# t- F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) [# H+ U+ ]! W5 d/ {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; y, d6 o2 r; B: R, ~6 j
1 b7 n9 B, V. b, a/ z' U

) I3 H3 ~2 e7 @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 19:29 , Processed in 0.042083 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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