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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ q, k) R9 D4 k) _# I8 f" O
  1. [code]EDMA sample test application
      }0 s: N( J5 D$ D
  2. /*
    + x" b  w" x' e' \" `% Q
  3. * edma_test.c! C, i8 j5 r# g. T; J7 Y4 s/ n
  4. *
    ) @. c6 i3 a% F, D5 S
  5. * brief  EDMA3 Test Application+ H  C8 B# c7 c5 ~' l9 T
  6. *8 P+ o0 M: N/ J( h+ x6 W/ e
  7. *   This file contains EDMA3 Test code.
    * G8 s& ^7 _& k8 g
  8. *+ n7 M+ Z, b4 j# G6 e( J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 j* ]! ~$ L) X) ?7 y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 Y! a5 R5 E* ^7 \
  11. *         TO CHANGE.$ X) e- Z+ p! [6 B
  12. *
    1 o) [( k- U( ?7 d( G* `0 W0 E0 c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! U9 A+ p2 N& q" P
  14. *
    2 L4 N1 }; k% B; n
  15. * This program is free software; you can redistribute it and/or
    ) }1 F0 C1 ]$ u! H/ t( b. K) @
  16. * modify it under the terms of the GNU General Public License as6 A6 |8 C1 {- t6 T7 h7 h7 s4 c
  17. * published by the Free Software Foundation version 2.5 C/ z5 k! G) _* A( R
  18. *
    % ?  J' X- P/ r$ u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) T& ]/ Y% i! n4 j" J. I
  20. * kind, whether express or implied; without even the implied warranty7 A0 B, A( D9 M$ R2 N. `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) n! g/ V+ ~  W- q4 y0 M1 i
  22. * GNU General Public License for more details.
    / @! ^" I: U, z& C. V8 B
  23. */# X- A3 w' C; n
  24. 6 i- f' X" J* i( O
  25. #include <linux/module.h>6 N! a6 u+ ^  ]/ l
  26. #include <linux/init.h>8 w. R) X* B. ]2 m' Z9 N- O
  27. #include <linux/errno.h>
    $ N- m4 N' v8 H0 p( F& a( N% V
  28. #include <linux/types.h>
    $ a* }: V% ~8 k( s* m
  29. #include <linux/interrupt.h>0 x& I9 v. y" ^' g
  30. #include <asm/io.h>8 z2 E* A9 V* e" O9 m5 M7 {
  31. #include <linux/moduleparam.h>* g, V% x  c& Q" u- ]' S9 T
  32. #include <linux/sysctl.h>
    7 X& g9 d0 T" B' J$ K, A* Z
  33. #include <linux/mm.h>- K; m7 p! j! w# W2 K' |6 B1 [
  34. #include <linux/dma-mapping.h>/ w4 r; C% ?9 z

  35. 0 P, _! o, \$ u( o0 _  p7 K
  36. #include <mach/memory.h>/ y' g7 F! Z8 c+ l* t4 E  B
  37. #include <mach/hardware.h>9 n2 X8 h  B4 u8 R  \0 C
  38. #include <mach/irqs.h>% y+ ~4 D7 r) _3 y! v- ~& S( [
  39. #include <asm/hardware/edma.h>; x0 E6 P- Y( C8 p
  40. 9 z* x) ?& X1 Z. X
  41. #undef EDMA3_DEBUG
    - u! g8 @/ ~; t1 E2 m4 x) e6 h
  42. /*#define EDMA3_DEBUG*/
    3 `* F: S" }9 x1 l' a$ J

  43. 8 ]4 |$ ~% N0 {; ~1 O
  44. #ifdef EDMA3_DEBUG
    $ J" p7 c, |5 `% L5 u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 D: ^; O0 i/ f6 X! A/ P7 K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# a& _- v0 W4 N; D. [! A8 M2 }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! t* A, I8 J! l) F/ `: y9 u# B# e
  48. #else8 m+ u9 O) g$ C+ A# H' H
  49. #define DMA_PRINTK( x... )- W/ T# {' R$ \8 m: o
  50. #define DMA_FN_IN- E4 }9 {7 V+ n/ F# K/ m
  51. #define DMA_FN_OUT
    " b1 w! m; z2 G1 n
  52. #endif" ?. D, m7 Z7 y: o6 {2 }% i3 o

  53. " A) T' Q! V( q. L" f1 x4 {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% k+ U0 I! u: A! l
  55. #define STATIC_SHIFT                35 {. N# C) q; L
  56. #define TCINTEN_SHIFT               20
    9 w: Q5 {2 C: {
  57. #define ITCINTEN_SHIFT              212 P& V+ o  D9 b% g/ g4 B" S: f
  58. #define TCCHEN_SHIFT                22+ J: K; w* \. F, E* u
  59. #define ITCCHEN_SHIFT               23% l; \: @1 }6 |, _, C+ I
  60. 7 U  k1 k3 e4 W6 g
  61. static volatile int irqraised1 = 0;
    5 R2 q/ a. u, h+ A
  62. static volatile int irqraised2 = 0;
    , m& _( W$ J- E
  63. - e+ S5 O/ j6 Y$ E) H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# a3 a# p% \* B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 g( T- S9 X: q0 H8 }; e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) _" V7 m! ~3 N; ^% V& Y* X! {  p2 U6 T% y

  67. , Y0 q3 s- a3 `9 H( Z  b
  68. dma_addr_t dmaphyssrc1 = 0;7 j! o0 v, u* B/ X6 w9 F
  69. dma_addr_t dmaphyssrc2 = 0;
    6 R& J( ?/ j& X! m$ n( w" L* J
  70. dma_addr_t dmaphysdest1 = 0;7 F1 |& T( R+ J/ x5 k
  71. dma_addr_t dmaphysdest2 = 0;& \% ]& t: p; W' ^; V7 j

  72. ) v! s4 Y, ]- H; y/ E
  73. char *dmabufsrc1 = NULL;
    3 \5 E# ~" ]8 j" O
  74. char *dmabufsrc2 = NULL;4 g" R7 w8 t1 Z4 V  V; Q; o
  75. char *dmabufdest1 = NULL;6 |( L0 d7 ^/ e( O- B
  76. char *dmabufdest2 = NULL;
    0 c# h9 v! f# [( A2 a$ A
  77. ! I* V$ y' A! D
  78. static int acnt = 512;. Q& k+ h: U- X; }
  79. static int bcnt = 8;
    6 D" _: M* D/ b  \! [) K
  80. static int ccnt = 8;
    & n3 H# c% Q1 a5 k1 J; b

  81. , ?" Y0 |" Q0 Y6 W
  82. module_param(acnt, int, S_IRUGO);
    # C7 k& \: X- h) x1 h0 v
  83. module_param(bcnt, int, S_IRUGO);
    ! Z# ]# T& }7 [6 T$ U0 i1 }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ ?2 B0 q" E2 b! [1 O' |4 `

6 L% o* {6 ^3 b5 s; k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ p1 _% P. l0 l* y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 W9 J9 _) P3 m! `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: U" t6 F4 Q/ @- E  P/ O
" C& W2 Y( a, z3 J1 e, X4 G! v  v8 D+ ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 05:14 , Processed in 0.040182 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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