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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 h& c5 _) B) l- \3 G1 r- \7 a
  1. [code]EDMA sample test application
    5 {: K! E% i: N! `
  2. /*
    0 _3 V4 m1 ?: y' P- i  y
  3. * edma_test.c2 q! H& ?3 d( r0 U
  4. *
    6 ~) B4 E1 Q6 V3 `& Y1 p
  5. * brief  EDMA3 Test Application
    8 R7 {8 @: a& A
  6. *6 T% s# F" j' ^9 d# o1 ]# `1 u
  7. *   This file contains EDMA3 Test code.
    8 D9 q: \: Y/ X5 t9 C. Z1 w
  8. *
    , H: [& ?6 W( ~2 \; N! N" \9 B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: C' ^  n& S& m; W8 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 D) m( C1 F6 c
  11. *         TO CHANGE.
    : |  f! L/ W( U" l
  12. ** L; T# ?5 l4 V: F* j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; X$ O8 S& S1 ?1 @
  14. *3 a7 F$ r( i3 i* s7 A0 y
  15. * This program is free software; you can redistribute it and/or' y) t# B* B; U0 @( A  {4 j! s
  16. * modify it under the terms of the GNU General Public License as
    & E- a9 m+ n. [% u3 |" R
  17. * published by the Free Software Foundation version 2.
    ! Q  p3 M; o# r2 r/ z$ L
  18. *
    / W% D- G" U- |$ E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 X" A/ T' }# s, i: R& ?$ O
  20. * kind, whether express or implied; without even the implied warranty! g7 ~& S6 H/ b8 J' @( J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) ~8 u, k) j7 K: q& [
  22. * GNU General Public License for more details.
    ! c9 m  T' P: E* c# f( y0 S0 ]
  23. */
    0 N* V. y, j6 c2 i9 S

  24. * H6 A. |, ]6 E, G( `6 N$ e. o
  25. #include <linux/module.h>% Y) ]1 ?' Y# M9 O
  26. #include <linux/init.h>/ O% n2 s4 |5 H
  27. #include <linux/errno.h>
    $ N6 M; X3 p+ ?( _7 x6 \
  28. #include <linux/types.h>4 j" T. I2 g3 r# U4 b
  29. #include <linux/interrupt.h>* H3 `; l/ Q- D7 u' W2 q
  30. #include <asm/io.h>
    " X9 ]; |4 E9 T  w# Y6 c5 F
  31. #include <linux/moduleparam.h>
    / k8 u( a2 m% Z. [* e
  32. #include <linux/sysctl.h>
    5 B# g& J, j2 X) v9 R/ D0 ~7 ~
  33. #include <linux/mm.h>
    8 x6 a$ {% D$ E8 c/ z7 j2 h
  34. #include <linux/dma-mapping.h>
    : C  w5 W/ O. n: a! G+ r2 ^

  35. 4 m9 |) i3 x# k6 N3 V# \2 s
  36. #include <mach/memory.h>4 n6 k- A* z. s! F
  37. #include <mach/hardware.h>
    " {8 ~" B' A! [
  38. #include <mach/irqs.h>1 c+ g' M5 f8 R' P
  39. #include <asm/hardware/edma.h>2 }% k8 Y% Q6 g; M: v
  40. $ ?' Q- t" b% w5 b# p
  41. #undef EDMA3_DEBUG
    % B: U8 |& ?0 P& h2 I
  42. /*#define EDMA3_DEBUG*/2 P: {3 Y% G" W  j2 S

  43. & T4 ~, h2 ^5 z9 D1 ~/ {8 @
  44. #ifdef EDMA3_DEBUG5 w: Q' E: Q) _! n: ?- R  @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & L- z0 ]6 C# M+ h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" X% D( [4 M  t4 a, v8 o. F. A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); G0 N0 _" p- \) x; H
  48. #else
    * N" O3 g0 w" m9 v0 S
  49. #define DMA_PRINTK( x... )! F& D& a9 O; `( y6 |) w$ D
  50. #define DMA_FN_IN
    5 P! f& D. A9 U
  51. #define DMA_FN_OUT0 P! Y" \& C( W3 y
  52. #endif
    7 M+ |1 ^9 b0 K8 w8 o  N
  53. % h$ O5 A0 l6 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# u6 M- X% b- U: ?
  55. #define STATIC_SHIFT                3
    $ \* \, u( l% g2 S
  56. #define TCINTEN_SHIFT               20
    4 ~# y) }- q  j& W2 t5 B
  57. #define ITCINTEN_SHIFT              21. x9 R" {5 N9 S8 L. Z7 F
  58. #define TCCHEN_SHIFT                22
    8 k1 ?* l- l2 k8 j
  59. #define ITCCHEN_SHIFT               23! m. _+ H5 c, ~+ e4 F

  60. & E: a# H, E% c. }0 A" Z" k: z7 J
  61. static volatile int irqraised1 = 0;
    " Q" S+ N" Y9 _. Y$ E0 p% l
  62. static volatile int irqraised2 = 0;
    % g, E8 s! ^  f- E
  63. / L) G. i5 u1 v. q8 J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      K2 C7 A  }4 m7 @$ ]5 `$ j" ^. I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ?9 j3 X5 M  E: B6 E: [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! Q) Q2 o, ~' a8 ?' w
  67. ; k% R3 @) n/ o' S- W$ n) ]
  68. dma_addr_t dmaphyssrc1 = 0;6 z5 I5 X8 D% ^% X
  69. dma_addr_t dmaphyssrc2 = 0;  u! t, g: D, a6 M
  70. dma_addr_t dmaphysdest1 = 0;) x5 u, ^2 p& j" y- P+ t7 ?
  71. dma_addr_t dmaphysdest2 = 0;' g6 m( X7 n% Z

  72. / }5 p2 ~4 E2 f9 @# H
  73. char *dmabufsrc1 = NULL;2 Z. ?. o5 w/ y# G/ _
  74. char *dmabufsrc2 = NULL;4 N0 O" C( a) V. b% w
  75. char *dmabufdest1 = NULL;) M6 M# P" _' d* F! w$ j% g4 W7 x
  76. char *dmabufdest2 = NULL;
    3 a3 W" Y0 w7 @( @
  77. - u" ^) W+ I! s- D7 g
  78. static int acnt = 512;# ?) j- E8 f6 C# o+ S' l% u
  79. static int bcnt = 8;
    0 ~/ v' W4 x4 z8 M3 c( r5 c+ o
  80. static int ccnt = 8;
    4 ^( }: Z) ~+ y$ L1 f- _" I
  81. ; z  n* u+ r" D3 N! x) B
  82. module_param(acnt, int, S_IRUGO);
    ; L( J! ~/ M4 B1 k. G! H6 V
  83. module_param(bcnt, int, S_IRUGO);+ h* q8 [3 Z% G) o! C- P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 n6 v7 s& X! d0 k
$ u4 q1 T4 I# P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 x; B8 C+ k7 P. f5 g# {# N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 D7 j6 Y" l$ M" Q5 {! ~5 J) c2 Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- |. ^2 U) {5 e
# m& o2 ]$ l* |* H1 Y, @0 S

9 H/ q3 K& G. F/ ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-12 21:48 , Processed in 0.039757 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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