OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . N& k8 d% Y  C7 S' Y8 J7 }" h; z3 D3 Q
  1. [code]EDMA sample test application- v7 F" K" D8 m# e" z) K
  2. /*
    8 o: R9 p' G9 O6 w4 W+ @) P" M6 G: U
  3. * edma_test.c
    # S9 Z  ~  P$ w% i
  4. *
    " V# Z  B5 I5 O  E% r$ u, j
  5. * brief  EDMA3 Test Application9 o- m8 Z6 q* V# i+ b' j# N
  6. *$ L. _, _' r' f" v+ e
  7. *   This file contains EDMA3 Test code.: `$ V" D! U5 @8 z* o& d+ M
  8. *
    / R) ]  ]. i3 L$ P% G/ H4 ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : p9 ?" B' R' L3 V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . A* N8 w8 }/ l( b8 p* |, O2 R+ `
  11. *         TO CHANGE.
    0 u& B/ F3 M3 g' x% _
  12. *% q# \; T3 c, i# J' }* `( A, a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 W, [: |9 X( Q! a
  14. *
    9 B' v+ n2 |; K* z; N
  15. * This program is free software; you can redistribute it and/or
    , \9 x9 O4 d5 g8 ?4 L
  16. * modify it under the terms of the GNU General Public License as
    + w$ V6 {3 v) Z5 A
  17. * published by the Free Software Foundation version 2.
    * L3 Y2 P" @. c) z8 m
  18. *3 W, O0 N# C, D( v" J6 M$ J( N2 |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ [' q3 w" W( X
  20. * kind, whether express or implied; without even the implied warranty9 O- h7 Q/ K$ s& M( T1 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 a. n6 p9 x6 O- X
  22. * GNU General Public License for more details.
    4 l1 m1 R& O/ c/ X
  23. */. j5 u9 `$ E  ]$ {2 `

  24. " F- g- ]1 Q+ t2 Y. k2 T
  25. #include <linux/module.h>9 l6 |1 ?% h  w1 k% k
  26. #include <linux/init.h>
    ; Y+ i. F: J1 S
  27. #include <linux/errno.h>
    6 T# E  V3 T5 R5 q" i
  28. #include <linux/types.h>
    & ?) |+ y5 ]  t, z% i+ F1 y, I
  29. #include <linux/interrupt.h>! E% F$ j& D0 @# a$ p! h9 v- J
  30. #include <asm/io.h>
      h) [) @! c; k2 Q. s) U& u5 a2 R! K
  31. #include <linux/moduleparam.h>
    0 P' _6 m4 ?* a% r  T( F6 M
  32. #include <linux/sysctl.h>
    / Q' ]. T& U+ E3 _. N
  33. #include <linux/mm.h>
    ; w: ]! ~* V1 D1 k% o- s. T
  34. #include <linux/dma-mapping.h>. Y6 u, G$ P: T8 ^7 q" y

  35. % ?0 y9 L" W- b6 t; N  b
  36. #include <mach/memory.h>
    , D  W, }' @2 n  U( `! k, [
  37. #include <mach/hardware.h>1 y# i. q- Z7 P( W) D
  38. #include <mach/irqs.h>
    . |8 Q; {4 T& z0 c' ^
  39. #include <asm/hardware/edma.h>+ B3 _5 J4 }' X4 @. Z

  40. 6 Q2 a# K6 g7 n7 x4 H
  41. #undef EDMA3_DEBUG
    ; W" L/ l8 }5 p5 Y  k
  42. /*#define EDMA3_DEBUG*/0 F* T9 s2 B/ S1 R3 \) M, Y7 l. n

  43. / l$ C* R; @. o' F8 P: o9 a7 e& p
  44. #ifdef EDMA3_DEBUG
    . V' `' k- ]+ I9 U# f6 \, g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( Y9 W* I$ Y8 J1 S8 [5 z% _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + q6 a/ u! q- g. ^0 S2 _7 y* F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' h7 c/ H$ u4 L$ G
  48. #else
    * ~0 ]- {6 X1 c8 E, E
  49. #define DMA_PRINTK( x... )! U( F) L7 I( _! d* x% g0 |
  50. #define DMA_FN_IN+ l6 [9 F' d2 O/ M$ [- n* d; G
  51. #define DMA_FN_OUT1 D- m7 u% |& j0 y6 V/ q. ]: O
  52. #endif# n) F6 K( t8 W3 F( c, \

  53. ( k1 ]' ~) a1 A& C- c" J4 w$ d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ t) F1 B* @/ r, |9 Q$ i2 d
  55. #define STATIC_SHIFT                3
    , ^  c4 v8 t% e
  56. #define TCINTEN_SHIFT               20. A' v( E8 z) t: C4 \& y% h8 z
  57. #define ITCINTEN_SHIFT              21
    % C. Z5 r" |( ]7 ?4 N6 z- H# D7 ~
  58. #define TCCHEN_SHIFT                22
    ' b$ F! D) K- O3 s6 ?
  59. #define ITCCHEN_SHIFT               233 w* D7 c# }3 Q' p3 ?5 t$ M! P

  60. ( F% M+ [7 A6 a, r9 S
  61. static volatile int irqraised1 = 0;
    " f0 R$ y; U7 a; j; K
  62. static volatile int irqraised2 = 0;
    , D  T& N3 M0 r
  63.   {+ j% c- D# ?. B' U% ~+ m8 S3 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 Z. }2 R1 _! r# E" o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & q2 k/ n# y  i1 Q" b# _$ x. G* F( v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- S; \' m2 d9 A( {8 E
  67. " d+ P# h# v* ~9 y1 W3 f% U8 F
  68. dma_addr_t dmaphyssrc1 = 0;
    ; o4 J1 t; @& V' P: L! S
  69. dma_addr_t dmaphyssrc2 = 0;" E; e" J+ A( s1 m$ A
  70. dma_addr_t dmaphysdest1 = 0;
    $ d4 {$ q5 o5 L4 D: W
  71. dma_addr_t dmaphysdest2 = 0;
    ! Y3 ]# d3 a8 u# ^$ Q5 A
  72. ) u8 F- o. B! j9 Z9 U) \' s# ?
  73. char *dmabufsrc1 = NULL;
    # [* e! _( s; Y+ ?8 v( u
  74. char *dmabufsrc2 = NULL;2 l/ Q& e: Y" x1 k. A( d. K
  75. char *dmabufdest1 = NULL;
      [+ K! c0 ^$ H' W: n# s* P
  76. char *dmabufdest2 = NULL;* B$ \, B- R# @+ K  s, {6 ]2 W4 B
  77. . z- D0 K) I1 V
  78. static int acnt = 512;
    7 V, U" Z( x+ r9 Y/ Y5 \/ X) z
  79. static int bcnt = 8;( h6 Y* M1 k7 u! A9 p
  80. static int ccnt = 8;
    0 k; Z8 g( [$ S7 ^' |' o

  81. + Q, L# O. }# i2 w
  82. module_param(acnt, int, S_IRUGO);1 }' ^, n0 N0 o+ T4 c4 ~. B
  83. module_param(bcnt, int, S_IRUGO);
    9 G3 G; a/ @4 P/ }' e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) t& u; }4 Q: ^5 H2 P9 Q+ _2 H" D. L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& E/ R9 k( z3 s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! G; G  t& ]+ [1 N' ^5 _/ H2 `     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; a2 K( j& {0 D  f* N. j

. R+ J: J9 b2 R, u' b4 q7 V* |: H
5 Z: C% D) S: ?% R6 {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-16 14:13 , Processed in 0.036997 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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