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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. H( e4 ?" W- L: b9 Z; m3 u
  1. [code]EDMA sample test application
    ! n& F+ x4 [; J, i) F; Y2 _
  2. /*
    / r# P4 h& R7 B: d; n! T/ X3 l
  3. * edma_test.c) K1 y/ J9 P+ M5 m+ h
  4. *# P( X) R. c# N/ J1 ^: O  x
  5. * brief  EDMA3 Test Application
    ' d# `1 H) `( {
  6. *; O0 C2 K$ q5 N
  7. *   This file contains EDMA3 Test code.
    + S, U7 A6 X, Y2 @
  8. *" V) o( V+ Q8 B6 ]( D; j. H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# t# A2 P1 N# s$ ?# V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; r: h( K7 n1 C) h: t
  11. *         TO CHANGE.& T$ U5 ^3 c- v  U0 c, J
  12. *
    # Y0 O( C: W8 `& m" n4 {8 _8 Z6 D6 A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* k& n8 S, ?/ u/ r* N: r' g- g
  14. *
    * ]- V, k$ }* U+ x
  15. * This program is free software; you can redistribute it and/or& M7 {+ Q5 Z: c* j+ V
  16. * modify it under the terms of the GNU General Public License as" ?5 b: Y& V7 ^' P7 ~" Q. P) E2 d% ]" ~
  17. * published by the Free Software Foundation version 2.
    1 ]. U) y  v% M. R2 S' _
  18. *
    ; g, g/ b  {. [- c+ @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , V# m, G( @, n+ ^- D( h. [
  20. * kind, whether express or implied; without even the implied warranty$ k7 y5 W8 G) n; C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " m7 }" `) o4 S3 ~$ n
  22. * GNU General Public License for more details.5 [+ f6 ^0 t' B# F
  23. */( G9 g) j. F* K1 b1 ?

  24. 3 A6 n* @( G. f0 k  D, i+ Y5 b
  25. #include <linux/module.h>$ ~% u) I* [; X
  26. #include <linux/init.h>; h0 i+ n! n2 T, P) ^0 P
  27. #include <linux/errno.h>7 @7 I9 z8 }0 R7 h# c( J* ]
  28. #include <linux/types.h>
    + v# \2 f2 a5 f7 a" P' x) C
  29. #include <linux/interrupt.h>
    / C  A5 X0 A0 y& t
  30. #include <asm/io.h>
    * y: F. t" Q- ^& v  j! c
  31. #include <linux/moduleparam.h>
    # y7 \3 p7 X8 b5 w& `* P: i
  32. #include <linux/sysctl.h>3 t7 {9 S2 \& L* B
  33. #include <linux/mm.h>
    9 j) `' T/ \' ^* P8 `1 v. ?
  34. #include <linux/dma-mapping.h>
      G. t4 F9 s% N: X8 \

  35. 5 a* \# v7 H6 P7 X
  36. #include <mach/memory.h>
    7 S; h4 d3 t5 m* V, c0 ^
  37. #include <mach/hardware.h>! a/ z+ ?' \& ~+ {. a- w
  38. #include <mach/irqs.h>: [4 L' y, m6 C8 r) \( \
  39. #include <asm/hardware/edma.h>' x" n1 t' ]* l' Y$ o; P$ P

  40. ( ~' `+ f+ c" \4 h
  41. #undef EDMA3_DEBUG" |; L. I' j; s
  42. /*#define EDMA3_DEBUG*/
    6 L* T) m# o: N/ J
  43. $ u+ w  C0 E7 T( |  O0 ^1 v
  44. #ifdef EDMA3_DEBUG
    - L6 s. q' v" W- }. i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * Y7 P( S2 t1 d; Y. x  r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# O! c+ g9 E0 W) V$ ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % E* K* i- y2 z; G- _' R
  48. #else+ a, t& e5 l: ^
  49. #define DMA_PRINTK( x... )$ Q- p) C% o' k( K+ t
  50. #define DMA_FN_IN
    ! y# [1 n* C) h5 E0 e
  51. #define DMA_FN_OUT
    ( d6 w, v: i2 {: Y! `
  52. #endif# ]! m: R. O$ u0 u( O& ]- l

  53. / T1 ]0 o# S. b9 p6 P  _( P  u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 U  @7 ~; ]8 l, B! z# M" ?
  55. #define STATIC_SHIFT                3
    6 o. @/ f9 ~  |' @" w- S: l" z/ f
  56. #define TCINTEN_SHIFT               20: b* [# L& o+ G* y
  57. #define ITCINTEN_SHIFT              21
    " s1 J, c# s8 g3 N# U0 }, U
  58. #define TCCHEN_SHIFT                22
    # A8 c2 D( h  |4 a, ]
  59. #define ITCCHEN_SHIFT               23
    6 ], A8 O3 ~4 r
  60. ; a5 w$ ]) a) X1 Y: H* M
  61. static volatile int irqraised1 = 0;! J( s8 P# L. k8 a8 s
  62. static volatile int irqraised2 = 0;
    5 q1 h' O6 q: }' j$ S( p
  63. - e# e' R! M* N2 |% X& p3 V4 {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 H% y, v# D' j- Y# p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 f: w9 ?3 L8 D! z9 o+ e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' C/ S8 @) R/ ?6 w/ [
  67. 0 Z4 x/ _' G7 P+ R4 G
  68. dma_addr_t dmaphyssrc1 = 0;
    - w9 p8 t- q/ n; X) ^$ S
  69. dma_addr_t dmaphyssrc2 = 0;
    2 m( u+ `; h# L5 s( j/ m
  70. dma_addr_t dmaphysdest1 = 0;( G0 g/ X) @* X& Q6 g/ ?  v
  71. dma_addr_t dmaphysdest2 = 0;
    4 e! K" U" \+ u3 x+ d

  72. / \: R. Q6 q+ n/ T# \& i
  73. char *dmabufsrc1 = NULL;
    9 I/ U9 i4 L. [: s5 N& K
  74. char *dmabufsrc2 = NULL;
    7 a2 \2 K2 M/ X- ]7 O. ]
  75. char *dmabufdest1 = NULL;# h* D% g# a7 v, F
  76. char *dmabufdest2 = NULL;
    ) q$ p0 C1 g0 S8 \0 b5 ?

  77. 9 x; B, C" c9 u( f
  78. static int acnt = 512;/ H$ o: x+ x7 }
  79. static int bcnt = 8;
    8 T3 @# e; m9 {. k0 u3 L
  80. static int ccnt = 8;
    5 f1 ~5 f' |5 ]5 o" u
  81. ; Y: Z' t4 F7 ^
  82. module_param(acnt, int, S_IRUGO);$ o6 `" q. h$ l2 t& U$ N, t( }
  83. module_param(bcnt, int, S_IRUGO);$ X! l! u% p$ Q) M" d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* l0 }$ O* y2 |/ z. o# U* M; W9 r- G6 G! D9 T- r2 c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 k! V/ ?" ]! \% I3 B! ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" @" m/ |/ e  {, G5 g3 Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ P5 s" D& U2 B; ^
* n# l; Z( n! R
" [" t! e2 z/ o  O9 j% c; e& j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 06:46 , Processed in 0.044795 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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