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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " Z2 k) A! A- c8 b
  1. [code]EDMA sample test application
    ) o+ X) M# s$ O& d1 r
  2. /*
    + q; E& E$ C1 q9 y, s
  3. * edma_test.c( P9 U7 \- ~! k" s* ?4 y3 l  b
  4. *
    , ]9 ]% w7 o  D- G% R$ D; V
  5. * brief  EDMA3 Test Application2 f& R9 a5 G7 {; `4 M
  6. *  a9 t% ?. L* ]# Y, K' Q& N; i* s3 r
  7. *   This file contains EDMA3 Test code.1 i7 U4 G! n) M5 r$ h
  8. *1 D8 n# X3 t5 G& ?" C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ \7 t2 s2 U' q# c1 `# _' ^  e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; x5 x- @0 h, f2 y8 n
  11. *         TO CHANGE.
    ( ]# i8 t9 R( L& E1 V) W; M7 u5 U
  12. *
    $ W# `& H7 B9 N( ^& u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ s. Z; o( u' }( Q  ]; G  h
  14. ** B7 l# L% c( v: U( u/ l
  15. * This program is free software; you can redistribute it and/or2 M. c3 d, e3 x, g/ F
  16. * modify it under the terms of the GNU General Public License as
    ; C) Y) O, H$ Y( q4 i7 P
  17. * published by the Free Software Foundation version 2., ~$ U4 D% Y# x, h4 @
  18. *2 z7 I, U* g4 {, P# f; E3 }7 G' h+ `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / j$ B/ y4 ]3 y& Y. P6 S* x
  20. * kind, whether express or implied; without even the implied warranty9 x1 d- v7 w0 R& A% T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . Z1 o0 M6 a+ S, Y3 `
  22. * GNU General Public License for more details.
    0 G; l! _4 |1 C$ J- T
  23. */# {! e! V# z, a0 s6 U
  24. ) Q% [4 E1 `( C
  25. #include <linux/module.h>* l4 F* b* a; V, \5 u& b1 ~4 }
  26. #include <linux/init.h>6 L7 E) V/ W; {# o
  27. #include <linux/errno.h>
    4 f3 T4 y& [* N& ~+ R
  28. #include <linux/types.h>
    1 ?3 a8 a6 I# M; a: |' \" Q
  29. #include <linux/interrupt.h>
    + V4 e- C! I& @) s8 ]
  30. #include <asm/io.h>
    $ x1 y4 x9 Z# _6 w9 U+ P
  31. #include <linux/moduleparam.h>
    . U& Y# I& I7 Y  V+ r4 w
  32. #include <linux/sysctl.h>0 T* S7 j# J% |$ k
  33. #include <linux/mm.h>
    + {) o# E# O3 x0 Z
  34. #include <linux/dma-mapping.h>
    $ t% x" O% I$ a3 r
  35. 3 R: d+ `" g( w! [7 G4 t3 u  k# P
  36. #include <mach/memory.h>+ b; g, Q8 z9 e& ?
  37. #include <mach/hardware.h>$ _9 L+ L$ ^, k
  38. #include <mach/irqs.h>4 g+ }3 g+ h  \1 Q- c1 u
  39. #include <asm/hardware/edma.h>
    ! Z1 Q! u/ m( Y% j8 J6 X9 K
  40. 7 K+ Y, D1 u; u* z' N$ `  e$ B) E8 a
  41. #undef EDMA3_DEBUG5 ~* j8 [$ O7 x: W* q+ X
  42. /*#define EDMA3_DEBUG*/
    1 ]/ r5 ~/ a+ z' ], x- w* V
  43. ) l4 V1 n. L" ^1 X0 O6 u" j
  44. #ifdef EDMA3_DEBUG' o4 e0 j/ w, C$ N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 p$ C2 f5 b/ d7 Z1 R1 r2 T& c6 c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 \8 D( f6 V1 ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 p& B- f4 B! R5 X
  48. #else3 P) @; f( l7 [0 h3 |: v, l5 F
  49. #define DMA_PRINTK( x... )5 G2 {" n. @7 d/ H1 p/ v) _
  50. #define DMA_FN_IN! |$ I" D" R) f0 `( o" L
  51. #define DMA_FN_OUT2 H0 o; a! Y9 g3 [9 I* B
  52. #endif
    3 s5 C2 h- D& h7 a& x
  53. # p& ]: n) K1 ^1 o0 B! t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ P- \  ?' ]3 a9 g
  55. #define STATIC_SHIFT                3" V5 E% i  a) \5 Z4 x. Q! k
  56. #define TCINTEN_SHIFT               202 i$ b; w: a+ O8 O4 W6 L
  57. #define ITCINTEN_SHIFT              21( s+ e4 k. R8 I5 D- {1 ?
  58. #define TCCHEN_SHIFT                22
    , Z+ O  s' X4 |8 I; D
  59. #define ITCCHEN_SHIFT               23
    , s3 ?# t1 ^7 u6 c  ?( j

  60. / h# V" T( _2 `
  61. static volatile int irqraised1 = 0;4 s. h' k# @( y6 M
  62. static volatile int irqraised2 = 0;
    " k$ e. I( t' K. _

  63. , I$ c) e6 v" a9 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' b" j' [* J/ a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : R( h+ Q8 T4 X8 Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 ~- O# d" V. l( X
  67. & }* x' y& w* g. E; j6 A( A
  68. dma_addr_t dmaphyssrc1 = 0;
    1 q5 T. _$ |: T0 o6 [
  69. dma_addr_t dmaphyssrc2 = 0;  ]$ t- L+ ?* V  B: r2 X$ i* u
  70. dma_addr_t dmaphysdest1 = 0;
    % e8 X2 Z+ n7 w5 [
  71. dma_addr_t dmaphysdest2 = 0;5 {7 _$ _9 V: a' K  m( y8 ^

  72. $ B9 U0 p5 P2 Y: Z$ L$ `
  73. char *dmabufsrc1 = NULL;% h: f. F% \" i1 w. a' k* m% H2 [
  74. char *dmabufsrc2 = NULL;- Z5 c) Z+ P) L, O: H0 ^5 t# d; e
  75. char *dmabufdest1 = NULL;2 Y, J! l+ X. f6 v( z/ W: H4 ?3 Y4 W
  76. char *dmabufdest2 = NULL;# a' n  N2 q/ X3 k% m
  77. 6 Z7 k5 w8 n% z
  78. static int acnt = 512;
    3 [: R5 \5 W9 {; B+ y
  79. static int bcnt = 8;; T) {* k; \2 v. u
  80. static int ccnt = 8;1 f6 J" g) @% v
  81. * f' H% V/ k6 R. d8 ?5 f7 Z# R
  82. module_param(acnt, int, S_IRUGO);1 B$ [- \% Z& j1 d# O: \# X$ s$ d
  83. module_param(bcnt, int, S_IRUGO);) \, T; J& G: y5 Z* _- h
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 F0 I% C  n2 G
$ ~6 ^7 p3 ^6 O3 o- I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! d7 Y. _: G) H& Uarm-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 }& Y- E' H, u) Z, Q) t0 K
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. s$ |/ d0 s' e, t4 o

; |" b, F  s  x0 x/ m6 _- Q* U: ?3 n4 y, n  j& T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-19 04:43 , Processed in 0.040064 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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