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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; L9 y& b* ]9 A4 c3 e' o
  1. [code]EDMA sample test application, l* L* b0 K+ R" v$ U* b' \
  2. /*
    % s6 a7 M; z, a
  3. * edma_test.c
    ( H, a# q5 `* C0 \9 N4 g4 i) M
  4. *
    8 S8 ~' B' J# e. q
  5. * brief  EDMA3 Test Application
    & l1 r6 R0 I- M2 M- o# X1 M
  6. *" P: G% k  E4 i6 C
  7. *   This file contains EDMA3 Test code.
    # U' e, {( j4 g- q, p  U( M& V+ s
  8. *
    1 m& E% h- Z+ [6 N4 f1 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 r" _% _* w0 x  s% p7 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ E% ]* v0 ?& b( E! X/ v8 c
  11. *         TO CHANGE.
    1 z8 X5 L3 M  o. o" e; t) ]; e9 F
  12. *$ Z' N  t* _, P+ z/ m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 U8 M& d8 F! N; i# n" l$ X: O
  14. *
    6 a/ R% q" D& I/ ?8 \
  15. * This program is free software; you can redistribute it and/or
    ; d" l" j2 X2 t: L! h1 n
  16. * modify it under the terms of the GNU General Public License as9 q8 j$ A4 n* ?9 `/ O
  17. * published by the Free Software Foundation version 2.
    7 U" z) i" I7 l1 t$ T1 P' A
  18. *1 O6 [; y9 [* }1 T. K4 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! f5 j9 Z8 }1 j% s; {/ h5 G0 Z& S
  20. * kind, whether express or implied; without even the implied warranty
    . E  A7 U( E1 {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 l2 K5 J$ l, B3 q9 J8 m
  22. * GNU General Public License for more details.. _! e) e- E6 C
  23. */3 ~0 D5 _* k2 [

  24. " k8 N; Y! [/ K, @5 g' [. F) j
  25. #include <linux/module.h>
    & M0 e$ ?0 x& ?7 S+ l# [
  26. #include <linux/init.h>* a& l: \  j9 B9 N( a: v2 F" q$ L4 F
  27. #include <linux/errno.h>& M8 S% s6 V& w4 m1 T2 d
  28. #include <linux/types.h>
    4 E9 P- T1 J8 W" A1 q
  29. #include <linux/interrupt.h>! Q5 M9 Y1 H1 |& e" V/ f; {" _) P
  30. #include <asm/io.h>0 `- D+ ?; x. o- j6 x. P% |# Z
  31. #include <linux/moduleparam.h>
    ! ?  K6 [0 M- ~3 R
  32. #include <linux/sysctl.h>( d, E- q) I- R: X
  33. #include <linux/mm.h>
    ) k/ Q# H( @$ l- g: F: g* d
  34. #include <linux/dma-mapping.h>! u1 `/ m; U' F# O/ H

  35. 7 \& O" q: }' F- S$ ]
  36. #include <mach/memory.h>
    $ {5 s: z! i' x- K
  37. #include <mach/hardware.h>
    , |. L8 [- r* U" Q4 ?" O% E9 \/ t
  38. #include <mach/irqs.h>
    6 Q( F0 l- u7 ?% @7 F
  39. #include <asm/hardware/edma.h>
    & \) ?0 V2 U% m; W/ m/ ~) M
  40. 7 E4 r- H& r6 P; @
  41. #undef EDMA3_DEBUG
    + b$ z8 i9 `1 |5 H
  42. /*#define EDMA3_DEBUG*/
    7 J, t4 n9 ?: _0 R

  43. & P  `$ @. z8 N# U( S5 u1 I
  44. #ifdef EDMA3_DEBUG; I; Y% `/ l- U* C  z# x9 c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 `0 R# ^, Y: V0 m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). U5 Z, W; s3 B7 S0 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * I, o: y8 q! r; V  j5 ^
  48. #else" Q/ m, R2 ^1 |! \1 O/ P
  49. #define DMA_PRINTK( x... ): \. x. _! m, J
  50. #define DMA_FN_IN& @' M" m, B3 e; a# B
  51. #define DMA_FN_OUT$ S5 Y7 N; O$ {. i
  52. #endif
    ; d5 X. m+ u0 q  s3 O- j; o

  53. " }- s$ I% }/ s% D8 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & o. P! n/ d( D
  55. #define STATIC_SHIFT                3
    ! Z5 |$ I3 l) ]+ T* @
  56. #define TCINTEN_SHIFT               20
    7 M/ p" v$ c* d4 z' x
  57. #define ITCINTEN_SHIFT              212 @/ P" ?8 N  V; Q0 R/ ~! ^, R
  58. #define TCCHEN_SHIFT                222 u1 J( T: |& c0 ^9 G
  59. #define ITCCHEN_SHIFT               23$ h' ]  k( z. A6 }. k# b5 l: z( `

  60. 0 b5 o8 ?8 Q6 T5 ]! z
  61. static volatile int irqraised1 = 0;3 Z" O" j- X8 E6 V0 t: x2 [5 F
  62. static volatile int irqraised2 = 0;
    " M, c% p- v. M, z/ A7 q0 ~

  63. $ n- q" D. Q' b" F- D; W" f, B; |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 O& X& G1 g2 {. Q( ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 Y) _  R$ e* }- U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 _# R$ E" M& M& V8 V
  67. ) t: v+ ^5 g5 k7 g7 z: `$ \
  68. dma_addr_t dmaphyssrc1 = 0;
    ( d+ \8 W$ y# v
  69. dma_addr_t dmaphyssrc2 = 0;2 M$ @9 k$ o3 s% {& T! s' `9 K3 R$ e3 r
  70. dma_addr_t dmaphysdest1 = 0;
    + `) V5 z& X7 Z# E' N, j
  71. dma_addr_t dmaphysdest2 = 0;) C4 a* w' T5 d5 ?1 N( y
  72. , r; \, L+ N! V- X6 n
  73. char *dmabufsrc1 = NULL;6 j. \, \6 L+ y9 h2 L- }- N& k
  74. char *dmabufsrc2 = NULL;
    5 ]1 S+ n! R2 K. C$ ]+ m7 z
  75. char *dmabufdest1 = NULL;
    / |. R4 W8 u7 h; O: [
  76. char *dmabufdest2 = NULL;; j4 c2 l9 I4 N# S7 H1 |7 [) T
  77. 1 W& G: J2 \; [( a2 R
  78. static int acnt = 512;
    ) s% C& S4 l- J5 z9 y  K
  79. static int bcnt = 8;! H4 U# g3 P8 H0 D
  80. static int ccnt = 8;" {3 V. ?/ q% G
  81. 0 z0 U% c& ^/ j) I, ?
  82. module_param(acnt, int, S_IRUGO);/ B) ^) w$ L" Y! b; R+ }
  83. module_param(bcnt, int, S_IRUGO);" n$ o$ @, @, I0 o) o7 _! G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& i  Q) p1 t' V0 X1 W
8 w4 n8 D: ^$ m3 J3 P. A      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) r7 G- ]. g9 {! @4 P8 K) ?9 }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 l, ?, C8 _5 _' ?* t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ a( w$ g4 M7 E6 }* L% u0 J5 u
$ l# C% ]3 \- r) X
" Z! o! M8 I& N4 C6 i' f2 x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 07:57 , Processed in 0.065351 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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