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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 p% F; |: O# e7 H
  1. [code]EDMA sample test application
      z6 J) R3 X. x1 C4 X
  2. /** i* D. d. K8 B
  3. * edma_test.c/ ^0 p' A7 F% P+ M3 k, n6 M
  4. *
    ! I  N) N) C3 Q6 V8 v
  5. * brief  EDMA3 Test Application7 L8 w5 O- v8 D
  6. *
    . r3 v2 R" f# K* [% `
  7. *   This file contains EDMA3 Test code.
    : j3 c" |& v  m+ T2 K* R- h
  8. *
    $ T& @. a# Z* d0 m, z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ S) f6 v0 Q0 A& I  Q. P2 _& C+ n1 C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & c" V7 B+ c  Y6 z$ C& \) F
  11. *         TO CHANGE.
    : p! B. C+ F$ j# l7 _
  12. *- i" X& g7 k- I/ p8 n- x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 n& z: E7 W0 I
  14. *
    1 Q" f, }  q- H9 f$ ]
  15. * This program is free software; you can redistribute it and/or% y1 r% \1 Q; B  l. v  e( L
  16. * modify it under the terms of the GNU General Public License as
    % [. ?: y) p, h- S3 g5 c' h" j
  17. * published by the Free Software Foundation version 2.4 E2 ~. C% {- H  D" {$ B8 o
  18. *
    " {% `$ k* y# t0 F  x' ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 E$ }0 A- g) e( H
  20. * kind, whether express or implied; without even the implied warranty
    5 E3 z+ X9 U! x6 T7 v1 e7 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 P8 s2 b$ N. E) i4 @$ s% C
  22. * GNU General Public License for more details.
    ! K5 L0 n- N% b! S" Q. b, y
  23. */
    ! R" n& c  [3 U

  24.   b& f7 x" m- Y; q& s8 W
  25. #include <linux/module.h>1 u# v! ^* I, @: c  B- n/ x+ w5 `2 k
  26. #include <linux/init.h>0 |. J# z, V' K# Z+ I/ X1 S
  27. #include <linux/errno.h>3 \& Z+ H8 s$ g4 t1 T- x- I- J: a
  28. #include <linux/types.h>
    ' c% [; r7 c) M5 z
  29. #include <linux/interrupt.h>8 y7 z" _2 N" x
  30. #include <asm/io.h>/ u8 ^: h$ b" v" W+ r# |
  31. #include <linux/moduleparam.h>
    ! C/ L9 l; {( I9 ~' w$ j6 o
  32. #include <linux/sysctl.h>
    2 R' o3 V, F$ \2 }9 h+ ?% \2 G# `
  33. #include <linux/mm.h>, o- n$ R; J4 V  C" k# c, J& H
  34. #include <linux/dma-mapping.h>  a8 b% Z* [" G9 K" f( }

  35. ' i9 ?  S. `* u
  36. #include <mach/memory.h>
    ' F* `+ M5 C% T5 J
  37. #include <mach/hardware.h>2 p! F2 V+ U3 S) s* }2 V% w- n
  38. #include <mach/irqs.h>" O4 I' U5 P) }$ q5 `9 H7 R
  39. #include <asm/hardware/edma.h>
    + B- Y, P2 P, f! `
  40. . c/ R+ d# |; e8 m
  41. #undef EDMA3_DEBUG9 l2 A& B2 S, P1 p0 y( J& }0 {
  42. /*#define EDMA3_DEBUG*/
    8 Q9 }* Y; `% d4 `  n, q

  43.   z- ]% G' t4 j
  44. #ifdef EDMA3_DEBUG
    5 z5 Z! i) C2 j' V! O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ \3 c* t4 ?4 Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( e% ]4 W* s% a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 v/ W2 a  d! T& k9 f$ o0 L
  48. #else% ~, |6 j: m: g
  49. #define DMA_PRINTK( x... )3 R# V# k- P5 q; J- e  W% Z
  50. #define DMA_FN_IN: b4 ?; E3 s/ ]$ s! ~
  51. #define DMA_FN_OUT
    6 P+ J0 C- z7 g8 A7 j
  52. #endif
    ; q; V/ h) ^" ?3 B! V8 ~( N
  53. , g- o$ H* T5 Q2 s( j: e' n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); x: N' [( H$ f0 o. R
  55. #define STATIC_SHIFT                3
    9 H7 p& O1 A4 P0 m. k6 c6 N
  56. #define TCINTEN_SHIFT               20
    ! [; w/ r7 u9 ?1 Q
  57. #define ITCINTEN_SHIFT              21- W% ^8 {. w% \' u
  58. #define TCCHEN_SHIFT                22: \  x' {! d; e' v9 f
  59. #define ITCCHEN_SHIFT               23: F: w6 p$ \+ S2 V
  60. % U2 B1 S+ t( W
  61. static volatile int irqraised1 = 0;) q" [+ [1 m( w3 q' u/ C+ e$ E
  62. static volatile int irqraised2 = 0;
    $ ^) y% w2 D+ G( D6 a# P4 I

  63.   S5 b" c8 N7 D+ @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" Q$ m( r+ E  y0 u5 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . p0 L4 ~! `4 [5 n% e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 A- R1 ~( P& U4 e4 n
  67. 8 d. R; d) ?1 o6 J
  68. dma_addr_t dmaphyssrc1 = 0;
    " j4 |' k  h" ^+ o: V* G
  69. dma_addr_t dmaphyssrc2 = 0;, D; r+ ?  I- _; X' J( n! D' l- l
  70. dma_addr_t dmaphysdest1 = 0;- w  ]( H4 i/ l& [5 P
  71. dma_addr_t dmaphysdest2 = 0;
    * c. w2 \  B* B) D2 D5 }8 ?

  72. + P' b. c  ~3 N8 \
  73. char *dmabufsrc1 = NULL;
    % A3 D! i, j* q* T6 s2 J
  74. char *dmabufsrc2 = NULL;
    , K8 N6 a6 _0 u9 E, n. p; ?
  75. char *dmabufdest1 = NULL;/ l# w, p, I9 E1 K( O; ?+ Q5 {
  76. char *dmabufdest2 = NULL;- m! ~1 C# C0 x% G
  77. + Q) M8 x2 L0 k) f9 |
  78. static int acnt = 512;2 D- _/ }- @9 O* u) `0 @( E
  79. static int bcnt = 8;$ H3 X' u7 Y9 s0 W, i6 U
  80. static int ccnt = 8;7 N3 H1 d( g, r5 F1 w: D) ?

  81. 3 B' U3 ^4 b1 d4 K8 t( b2 ^4 n8 a
  82. module_param(acnt, int, S_IRUGO);) N9 W4 Y" o- _  E' H
  83. module_param(bcnt, int, S_IRUGO);
    % b1 k8 T5 l+ y: N: `: _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; d& E9 o1 f" G2 K  C0 }* Y1 _. f( m
! p8 \, w) `6 f( ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: c, A2 B$ Y9 S" 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  h; W! y2 K" Y3 [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. j  @' M# @/ w: }3 q& I3 ]

! m' p( P5 i: H$ S  E& V: ~4 @4 S# k, _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 10:59 , Processed in 0.040816 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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