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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' D0 E; H. |( ]' @; D
  1. [code]EDMA sample test application- A: w9 ?, I( h  j9 T: N. r
  2. /*% \/ y: _2 c4 U+ ?# O
  3. * edma_test.c5 L! w& W7 r9 }! N  S5 I
  4. *% ]& E5 l0 N  n  q+ ^/ E
  5. * brief  EDMA3 Test Application
    5 ?: c$ a6 D! ?9 Y9 Q  |* ^
  6. *
    ; j. O3 N; p6 M" c
  7. *   This file contains EDMA3 Test code.' v' j; f- s2 D. |' m
  8. *
    3 K2 c! u0 z$ P9 _3 W2 Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 i# E3 @. J4 m2 [" C! s% x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 U1 Z' H, }' T
  11. *         TO CHANGE.. B" k4 x8 R) X/ i
  12. */ _; k  q9 |; c! J7 |$ E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  @2 I; w, A' k- A
  14. *
    + {5 W. ?& c, }5 R. [$ X
  15. * This program is free software; you can redistribute it and/or
    . L) P6 g2 ~9 g( o: ^; E& H* |
  16. * modify it under the terms of the GNU General Public License as
    % b$ L% ]6 n) o# j2 M4 r
  17. * published by the Free Software Foundation version 2.
    - e4 I" {3 M1 W- A" H( Y0 i0 N
  18. *3 ~! k% z  H/ j6 J- c+ a* X$ W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 N6 q, P2 u+ \3 m+ y
  20. * kind, whether express or implied; without even the implied warranty
    ! ~0 B# b$ u+ B3 x& e7 U" j; F+ b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ T' f1 C9 K9 {; J0 g
  22. * GNU General Public License for more details.
    3 C7 @' F8 q) z3 S. `, f/ o3 {4 Y" H
  23. */
    3 V2 L/ e- I: P4 G

  24. , P0 R* W% s. Z# |
  25. #include <linux/module.h>: v+ S% ]9 x% t
  26. #include <linux/init.h>
    ( a: K# \: r, a. r. v
  27. #include <linux/errno.h>
    * T& k: Z" b3 h6 {2 Q
  28. #include <linux/types.h>
    : ]( _9 t9 P# d7 y/ W
  29. #include <linux/interrupt.h>
    5 `  w: Z  @# k: ^: W8 k8 \
  30. #include <asm/io.h>
    & f) j# K  ~7 Q4 W" U
  31. #include <linux/moduleparam.h>
    ; C6 \9 t, m8 X7 N5 R
  32. #include <linux/sysctl.h>5 v* n3 N7 ?$ A
  33. #include <linux/mm.h>& y' t- k* }9 X
  34. #include <linux/dma-mapping.h>
    6 q+ M; J1 D0 ]  B; @- S* s
  35. - f' e- H4 i3 U% T
  36. #include <mach/memory.h>% Y/ q4 O: H. F
  37. #include <mach/hardware.h>5 M% U+ X* Q* ?3 T/ W+ l8 f
  38. #include <mach/irqs.h>- c, }4 D; N( [4 M/ C8 c
  39. #include <asm/hardware/edma.h>
      s6 a, s  Q+ g2 d* Y. q

  40. : N. h% O# }- O! \) T) w; Z+ i% Z
  41. #undef EDMA3_DEBUG
    # ~( t; K  e% |. f9 E
  42. /*#define EDMA3_DEBUG*/' q6 [# ?- V: Z: A

  43. # C, k4 Y4 H' U8 ^, G8 v8 v9 \
  44. #ifdef EDMA3_DEBUG
    $ K* u! \. T' g$ Y% ^5 O+ ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  X2 {8 S0 O8 }7 o6 w- Y7 v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) u9 w0 u  f$ u) @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) Z7 d; v! T% V) G+ n
  48. #else2 u4 }( m  E" f+ G+ m$ G; s7 p
  49. #define DMA_PRINTK( x... )
    & m+ H0 P8 }2 Y) p) {' k: V5 ~
  50. #define DMA_FN_IN
    7 O1 t9 e0 Q& D7 @! y
  51. #define DMA_FN_OUT4 @' }9 [" H, U  ^
  52. #endif( j/ _) o' C( X0 X, O

  53. 9 q0 C( ?+ `) l$ W0 z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . k* g2 t" I2 r  F( I+ l  W- a
  55. #define STATIC_SHIFT                3
      M7 n. K4 o9 A. e
  56. #define TCINTEN_SHIFT               20
    % p- [; N2 y5 h2 O5 R9 U
  57. #define ITCINTEN_SHIFT              21% [+ o8 r8 E7 q" a
  58. #define TCCHEN_SHIFT                22
    # G4 f; j4 I# @6 {7 f6 l, m8 p
  59. #define ITCCHEN_SHIFT               23
    4 s- U. D- C2 D5 Y( j( J
  60. ! E6 r, h) O2 [/ S3 d& H
  61. static volatile int irqraised1 = 0;. D5 j; g6 s& S: g5 [
  62. static volatile int irqraised2 = 0;2 G0 Z$ G. l& ^) s( x
  63. : K8 y; x; V5 w4 L- w4 ?8 D" @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) g! d# z; X5 [( t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 x  A6 }5 W- c0 K! [% N% t+ S' c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ `+ m' W1 Z- \6 P+ c: B  X

  67. 9 A( `9 o. _2 a5 ~. q
  68. dma_addr_t dmaphyssrc1 = 0;* ~$ A: Q5 w. p) O3 U7 m* v
  69. dma_addr_t dmaphyssrc2 = 0;/ ]* j2 w+ Y3 f: t9 b; |
  70. dma_addr_t dmaphysdest1 = 0;
    6 l, t, ]' p: l4 y, n: U
  71. dma_addr_t dmaphysdest2 = 0;
    1 w: z: }- \# y$ j4 t

  72. + U# ^+ [5 B- W& ]+ Z8 c7 G
  73. char *dmabufsrc1 = NULL;
    " c5 P# C4 b' U" n! x& w8 I( \
  74. char *dmabufsrc2 = NULL;& }, S- L* ?+ Y' U; @3 p4 u' {
  75. char *dmabufdest1 = NULL;
    ( `' E, M  M4 z) M8 m
  76. char *dmabufdest2 = NULL;$ W4 D7 M$ Q/ [' C( h: Q
  77. % Y. Y) g- }4 L
  78. static int acnt = 512;
    , S* I" i# U, o( x+ S& E" e
  79. static int bcnt = 8;
    0 v) k/ n3 ~, q# t' \9 A' a
  80. static int ccnt = 8;
    7 g5 ]" o: G# C1 b
  81. 6 V! c. Y6 D+ q) M& _& C% h- [/ w
  82. module_param(acnt, int, S_IRUGO);
    + u! d1 i. M2 |% G+ t) H
  83. module_param(bcnt, int, S_IRUGO);
    9 ^9 I7 ]: e! w/ @7 r
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" M( {( D+ W2 t- }* a6 ~
! X. @% y$ J/ C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ I7 M! P6 m- s; y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. q! L& m  ?! z9 y. _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 T) n' s% w; _, ^- J6 N5 [9 t" q  y' a) `* a/ O4 N
7 `% H0 f) Q" d+ [% `) B5 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 11:52 , Processed in 0.043265 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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