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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" O7 B- ^9 j- }
  1. [code]EDMA sample test application$ _( c+ j# Y; @( N' l+ E3 B8 z' A0 r
  2. /*
    7 M" j! Q4 H' N6 i7 l" F7 W' Y
  3. * edma_test.c
    5 _* x( m( O: o- W3 }$ ^
  4. *2 [4 K$ c" d7 r) u/ B0 r( k
  5. * brief  EDMA3 Test Application
    ! c, e2 y+ H1 u9 `$ f/ H
  6. *
    4 r# M/ f- v! q- j: U+ W
  7. *   This file contains EDMA3 Test code.2 b. J- Q! h) t3 ~
  8. *
    $ Z9 K! w  x1 m% U4 k: s9 w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 H" _! C5 D, K7 e+ C3 G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : {! l) ^$ F) _+ k2 ~6 H/ Q
  11. *         TO CHANGE.: N* p1 x; p  w# p% O' T, K2 n
  12. *: O  {$ z1 M- {9 _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : Q+ R! Q* g$ t
  14. *
    & P( D( S- ~9 G
  15. * This program is free software; you can redistribute it and/or% \- F& }3 @! @8 t2 @
  16. * modify it under the terms of the GNU General Public License as! T# _2 d+ k$ n  L
  17. * published by the Free Software Foundation version 2.! T2 y9 v; ^3 w2 `
  18. *
    4 B# |8 _; t3 y  o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 Y3 Y; b. ~. ~
  20. * kind, whether express or implied; without even the implied warranty6 t- Z) J" \- B* I8 C+ H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" h/ X5 s: `0 H) M+ p
  22. * GNU General Public License for more details.
    - X1 g' n- y+ e5 i6 \5 l+ O
  23. */
    # Z+ Y8 ^' x: u, k6 l: `$ C
  24. ! |& {9 _$ x. H& A' f
  25. #include <linux/module.h>3 Y+ _( f. _% s$ M3 \5 g3 @
  26. #include <linux/init.h>
    & k6 a( ?% o& V) @: ]3 p
  27. #include <linux/errno.h>0 f  S( K: a8 I+ j6 U/ O
  28. #include <linux/types.h>
    , m* r: U) f  s9 e5 A/ G
  29. #include <linux/interrupt.h>
    1 U6 ?+ f. B) a: l8 _& e, M
  30. #include <asm/io.h>, C& ^3 W, u- ~1 d2 f
  31. #include <linux/moduleparam.h>  d: S3 {* q9 a: P2 y3 t
  32. #include <linux/sysctl.h>
    ' K1 Z4 g# u3 I5 n3 N
  33. #include <linux/mm.h>
    4 p! R) g9 p4 E
  34. #include <linux/dma-mapping.h>
    / y0 U( e" y* v+ |9 l
  35. ' [, }0 N+ U; x* a2 v6 d& C
  36. #include <mach/memory.h>
    ' Y6 d" T8 K. x, P' |- C, ?
  37. #include <mach/hardware.h>2 |7 a" O& X8 m  J- ]0 t# R
  38. #include <mach/irqs.h>
    2 V1 a' R2 w' f; v. e* e" H4 |0 q
  39. #include <asm/hardware/edma.h>
    ( g' \8 W7 K/ u( d# i6 e5 H

  40. 4 D, A1 j  N' P. N! G/ O' `! R4 J, F7 O6 w
  41. #undef EDMA3_DEBUG
    1 }( ?4 }3 M# Z( n5 i
  42. /*#define EDMA3_DEBUG*/. E- v  [- k2 `% V4 H- @) J
  43. $ ^% I" Q' M9 _4 u! A
  44. #ifdef EDMA3_DEBUG
    0 d2 ^' w; P& o6 P' _) ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 i7 G: J6 b- V& \4 v/ |. f1 g8 |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - [. x* c8 R* N6 [4 ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): V  x4 z% ~5 z! b4 X- S) M+ h% V
  48. #else
    " h* |+ O) u* m* b* R1 C
  49. #define DMA_PRINTK( x... ); N; B; W" }3 P$ n; O
  50. #define DMA_FN_IN
    , Q. c) J) q" S6 }+ L
  51. #define DMA_FN_OUT$ j) x9 m* p/ M4 A3 C
  52. #endif) p9 n5 T) K/ q

  53. + T5 n, Y8 m3 |( U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / @" q4 g! X9 w- i* n
  55. #define STATIC_SHIFT                3
    2 Q! B) U8 z5 s' n  C7 V
  56. #define TCINTEN_SHIFT               20
    : O2 W8 U4 ?! y+ O8 t0 J4 {1 I  {
  57. #define ITCINTEN_SHIFT              218 k1 r. i; g& P5 m& }* L! Q. i* J
  58. #define TCCHEN_SHIFT                22
    ; z0 m; p! H2 p: y
  59. #define ITCCHEN_SHIFT               231 [$ r( b8 @: e3 Y

  60. - H/ x# ^& i0 P9 s
  61. static volatile int irqraised1 = 0;
    4 h9 X& X. q& _/ R7 s
  62. static volatile int irqraised2 = 0;
    : t: u( {6 J6 [5 t

  63. - j+ `3 `/ [3 p% |% c# L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : f! m2 C$ G- S4 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! M7 I; l2 p( B: H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; N, V2 q  {; z+ a

  67. : I: }" b# M1 J; n
  68. dma_addr_t dmaphyssrc1 = 0;
    / [/ B0 f* w: S2 v# ?& m
  69. dma_addr_t dmaphyssrc2 = 0;
    1 b) |4 o9 z* d& n' D! A; h' K9 A
  70. dma_addr_t dmaphysdest1 = 0;
    ; O" T- ~  _! t6 L& }/ ~3 L
  71. dma_addr_t dmaphysdest2 = 0;
    ! E5 z' H( P4 ^; i0 Z! f, b% B  u& s2 T

  72. + l; c  J4 i4 @9 V( M: @
  73. char *dmabufsrc1 = NULL;( R& \& z1 X; [
  74. char *dmabufsrc2 = NULL;' g3 ?+ A" R2 D
  75. char *dmabufdest1 = NULL;6 z7 y% L. J( F$ M% j8 n* f
  76. char *dmabufdest2 = NULL;
    5 w+ e. u6 E$ A

  77. . d9 W+ ^$ W: C: W4 ~
  78. static int acnt = 512;
    7 P' r0 x& ]1 t# F. T" a: l0 @
  79. static int bcnt = 8;
    0 e6 F& B. u( K4 w
  80. static int ccnt = 8;
    2 h2 I0 B5 W/ c5 d2 g+ f; }) ]

  81. 3 |) g1 B; W* Y6 i$ B0 X1 \) `% Z9 [
  82. module_param(acnt, int, S_IRUGO);
    7 H2 _4 W$ Q! c' C+ a
  83. module_param(bcnt, int, S_IRUGO);
    - J2 u- U7 @, J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! x0 x0 ]/ E5 g  Y; L4 ]& O2 d. f; a) F$ E5 I' K! ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 }+ K! i& B# l. N* @; [5 Z" q, \, ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, l8 `8 J4 C9 b3 l$ e# ~2 O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! X8 b3 Y& y6 d3 p
" O3 W2 [6 L5 J9 u
8 Z* q& C, b( V: k  l. U( Z4 K/ u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 09:14 , Processed in 0.038785 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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