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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 \  {! B( u7 m& \
  1. [code]EDMA sample test application
    7 q1 h& R, ^0 U( x
  2. /*
    - U% L8 \/ a1 G  a( k- B* Y) e: T7 ?
  3. * edma_test.c
    2 N4 s1 g6 l, f) _# v9 t$ E
  4. *4 e  {2 X9 P7 i. [/ N+ s2 [% A
  5. * brief  EDMA3 Test Application
    8 e6 c: c+ {( n& O6 W
  6. *- t: X) T4 R; e) ~4 Q
  7. *   This file contains EDMA3 Test code.1 P5 t& Q% m1 e( C' N  ~* [
  8. *2 Z3 c  a6 w. S4 S( \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : u9 Y5 N. o3 i0 [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 Y# ~/ Y$ K7 P
  11. *         TO CHANGE.% m; X4 w2 f% y1 Z* \# H' x  h: q
  12. *
    $ t4 q' W' @2 d/ K$ Q* f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ X* Z. z& |8 `; c
  14. ** l& i( c, h2 S: S) k7 i3 F
  15. * This program is free software; you can redistribute it and/or2 T, W+ s7 O! I, W2 w1 h( B0 V
  16. * modify it under the terms of the GNU General Public License as3 D/ @% f% W9 g3 _' t
  17. * published by the Free Software Foundation version 2./ P$ t8 P7 k, c: f
  18. *0 y$ O0 g  m  ~4 r( Y! Z* n/ x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& p4 @8 o9 e0 E( T# t# j" q" ~
  20. * kind, whether express or implied; without even the implied warranty' _- n( g4 l7 C( T% D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) v. L0 r; A% P4 @
  22. * GNU General Public License for more details.8 L* \5 h3 j$ O; U  F
  23. */6 L# r8 X1 ?5 V" A, R
  24. . b. |6 P% Z5 h5 y
  25. #include <linux/module.h>0 O& p. n& R. n% G8 X5 [& E
  26. #include <linux/init.h>
    8 D+ L1 T7 {8 B4 |2 c  o  h
  27. #include <linux/errno.h>: c3 N4 j  n+ v0 V% k) P
  28. #include <linux/types.h>3 v( s! j/ |9 H- u+ G- F/ p
  29. #include <linux/interrupt.h>2 A3 K  _( x7 u) I" p' K
  30. #include <asm/io.h>
    1 C' k5 ~* Q) j& J" s* @6 H$ ]1 z% H
  31. #include <linux/moduleparam.h>7 q" o9 O3 e; G7 A
  32. #include <linux/sysctl.h>
    7 h0 a% I" a$ H# c$ J, z3 G6 ]5 t5 N
  33. #include <linux/mm.h>
    9 P8 k$ `" Y3 p' Q
  34. #include <linux/dma-mapping.h>5 J: t7 _0 R) c$ \* Q( k
  35. / S3 _$ W, h5 v3 L0 G) e6 r
  36. #include <mach/memory.h>
    ( O6 Z4 ]) Y5 _0 X8 i
  37. #include <mach/hardware.h>% s# G, ]2 ~7 n
  38. #include <mach/irqs.h>/ Q9 O) {6 {9 v. Q
  39. #include <asm/hardware/edma.h>
    5 |& z  p$ T- ]( I- O1 n  ]9 C

  40. 9 ]0 R' j3 C9 ~
  41. #undef EDMA3_DEBUG2 c2 V6 b* d8 n* {8 D$ y
  42. /*#define EDMA3_DEBUG*/  L' U7 \8 J* U& z

  43. . k& S' ~3 X. d* M$ B8 X* J
  44. #ifdef EDMA3_DEBUG
    % [. R6 Y2 h# q6 T# Z3 g; m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% g5 R$ }9 o* ?4 q" [9 A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 _+ S* ^. F2 a7 V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' j6 t, w5 j% ^/ Y- a
  48. #else- P8 c( P+ k8 M1 z8 M. |
  49. #define DMA_PRINTK( x... ): `$ N' `4 y( z. l* M- s+ L
  50. #define DMA_FN_IN
    $ m. w. {: F3 M+ s* e
  51. #define DMA_FN_OUT
    - G+ ]5 p, D# M; U! R( V6 U! c* @+ @
  52. #endif# g- f* a+ G; n  }% {$ b3 L3 q7 B4 F

  53. 6 i& x/ T' b! L8 G* _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' C# t: }/ Q2 ~; b/ Y
  55. #define STATIC_SHIFT                3& }! t% d5 |4 }: Q; K
  56. #define TCINTEN_SHIFT               20
    # _: v- K) x& P- T1 ~& B6 J& l
  57. #define ITCINTEN_SHIFT              21: F, w; _3 A  d1 C1 Z
  58. #define TCCHEN_SHIFT                22  z, u/ |# Y. d  u( d9 `6 m0 Q
  59. #define ITCCHEN_SHIFT               23
    . e: k- ~5 `1 Y" n8 ~
  60. 0 l1 d8 s, j9 s& z) ^
  61. static volatile int irqraised1 = 0;
    7 t: L" `( f" [' ^
  62. static volatile int irqraised2 = 0;
    + U. u8 i( @5 o( P) P6 U

  63. , {( P/ a& k$ J) ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * _& Y) J: |3 M& s* P( l8 D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 F9 L* F, g) m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; l. O; K' s1 @# U

  67. 0 l/ Q  v* \: U. G* L& H; J
  68. dma_addr_t dmaphyssrc1 = 0;5 G, I$ ^# S0 f* t) e, h6 ?
  69. dma_addr_t dmaphyssrc2 = 0;
    : v: v: u0 I8 V; R4 B8 a8 P9 c
  70. dma_addr_t dmaphysdest1 = 0;" n3 E- f9 w- ^; d2 G: v  W
  71. dma_addr_t dmaphysdest2 = 0;
    & n" z& o; o2 E2 t6 ^9 V- E
  72. 3 s6 T' J* _% i' B- }( i( A# h
  73. char *dmabufsrc1 = NULL;* d! ?5 K  r* \  W7 @
  74. char *dmabufsrc2 = NULL;+ }9 l2 l. x+ j( P9 d
  75. char *dmabufdest1 = NULL;
    ! C8 S' g, Y. t2 r6 x
  76. char *dmabufdest2 = NULL;
    ) ~' o2 G7 y8 b2 g
  77. 1 u) k4 I' n# M+ k1 _
  78. static int acnt = 512;
      ^$ i3 G$ l* Y
  79. static int bcnt = 8;
    4 r) o, w) o! @  M3 ~0 l+ }
  80. static int ccnt = 8;
    3 B8 R, M. d0 y

  81. ; a+ W$ p5 s6 a; x
  82. module_param(acnt, int, S_IRUGO);$ Q* i: {# Q4 V1 O
  83. module_param(bcnt, int, S_IRUGO);
    3 T* O7 z# V9 h4 H
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- z2 K9 X8 G; W$ T1 Y
/ W6 A7 s# ]. T' s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' q- f" n6 |/ t  B+ Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& t) ^( r' K9 _1 Y9 Q# \, L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ Y5 i& m- w- j

1 r7 r7 O) g" F4 z5 T$ E; |# t$ W; Y- {. C# A, J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 04:06 , Processed in 0.039634 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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