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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! `/ S7 H2 w3 A$ G% ~! I
  1. [code]EDMA sample test application$ `3 x. X( v  G! g
  2. /*5 q1 |9 P7 R- R- d
  3. * edma_test.c
    # \' E1 N% n( w' K1 \
  4. *
    5 b( t, F3 ~1 C6 _8 N
  5. * brief  EDMA3 Test Application+ v. q6 |. B0 Z( e
  6. *
    : G5 b2 D5 W4 }- ~; x
  7. *   This file contains EDMA3 Test code.
    , }& ^8 G# }& k0 f+ T6 C
  8. *9 D+ B+ k4 o, N; f! @# r% E4 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 r+ N8 l# s2 J) N. k1 o0 f8 F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 ^$ J6 H% K! l! T
  11. *         TO CHANGE.
    0 ?' J9 {+ B. _# O# ^/ E# `
  12. *' A* f, ^. p+ [+ P9 F" j( q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * M+ Q# g: w6 [
  14. *
    5 D- V& j% q. H0 k
  15. * This program is free software; you can redistribute it and/or! Z* Z0 y- n- }1 K+ i
  16. * modify it under the terms of the GNU General Public License as
    $ Q1 N& u) }6 _1 p$ ~' ^
  17. * published by the Free Software Foundation version 2.4 H9 y8 S- R# c% w
  18. *" [/ C: n4 I" L( O5 L0 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & o0 l* G% j/ c2 |' R0 ]+ U8 }' T& t
  20. * kind, whether express or implied; without even the implied warranty) _! @, E7 ^# w+ Z4 x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. `  M+ k3 v0 f5 e$ E+ H2 c: V9 B2 u+ a
  22. * GNU General Public License for more details.2 j# }& J, }/ u7 @) y) E' M
  23. */
    " P" U( [2 ^: |: {) \$ ~3 o. T
  24. 5 Z  s5 ~& k% L$ z8 ?
  25. #include <linux/module.h>  n4 t; x3 U, [; r; ~
  26. #include <linux/init.h>
    . H1 I; h1 {1 X) Z
  27. #include <linux/errno.h>
      r$ ]* @5 @  G6 W; V
  28. #include <linux/types.h>
    5 b2 N4 C2 u  \% v
  29. #include <linux/interrupt.h>
    . l: f4 ^" {$ b
  30. #include <asm/io.h>
    ( ^- P4 V( {  l
  31. #include <linux/moduleparam.h>& p$ S8 f# H) d' h/ g
  32. #include <linux/sysctl.h>! W2 Z" F, w0 A6 d
  33. #include <linux/mm.h>- b& X9 P. P/ T) \3 U
  34. #include <linux/dma-mapping.h>
    5 B) D& a; C$ [, X8 P0 ^' x& f5 }

  35. + l; `: V5 z* q& t. J$ R0 D
  36. #include <mach/memory.h>
    # b+ j; l5 |# H9 D- {
  37. #include <mach/hardware.h>
    7 n+ S4 @1 Q! S4 F; I- @
  38. #include <mach/irqs.h>" D/ Q1 {  S0 x, v1 x- N+ |
  39. #include <asm/hardware/edma.h>
    4 h2 a( `$ N% F8 ~

  40. & R& H, \5 s; f& c7 b& T4 o
  41. #undef EDMA3_DEBUG; r4 `  Q; ]( Z7 B8 E1 q  B
  42. /*#define EDMA3_DEBUG*/) V- h, L. w3 ?5 H) @/ ^

  43.   q" u$ w0 y7 {, q
  44. #ifdef EDMA3_DEBUG# W* Y" G2 }! w! ~$ {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / r" }! I! B+ W/ ~) k! H/ L4 a( n+ C! ^" k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + j2 c5 L7 N# d* z8 |/ n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). s& Q2 c+ k, x. \2 k& s3 `$ V
  48. #else+ C6 i9 G: S0 \7 j+ S
  49. #define DMA_PRINTK( x... )
    : @; A" i7 m, H7 l$ W6 c( w
  50. #define DMA_FN_IN
    - P9 c4 b/ P8 C: z
  51. #define DMA_FN_OUT; r# T& l" F% w' j! S3 A" v: ?/ z
  52. #endif3 }7 h; ~& J/ x9 z2 p3 w' q, D

  53. 8 Z2 W* ]5 L! T! V0 b# f  c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 O4 @) y, Y) U5 H# y' u6 i# r
  55. #define STATIC_SHIFT                3* T+ U) V8 p& {8 t: r
  56. #define TCINTEN_SHIFT               207 ^; r3 [: W9 t3 G7 \2 N
  57. #define ITCINTEN_SHIFT              21# a5 ?2 t) w% A$ \& H
  58. #define TCCHEN_SHIFT                22
    1 N; r$ C2 Q) b' s3 v5 A( U
  59. #define ITCCHEN_SHIFT               23* H/ |. f8 ~3 E4 S) L6 B
  60. % N; ?% u) p6 I+ f2 S, I
  61. static volatile int irqraised1 = 0;( U7 q) r8 P: V  `4 Q1 Q4 n+ `
  62. static volatile int irqraised2 = 0;& K" y  l  u9 n$ _  q8 ?& ^
  63. # m* o- k3 f" U2 R  ]2 N; m0 _+ F7 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 n: j' Y9 I7 a5 [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 I/ ]" L8 F- X3 G: A: X7 i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * l5 T% l+ g1 u8 J
  67. 4 c2 _8 h# y& y' h/ @
  68. dma_addr_t dmaphyssrc1 = 0;) y( i4 |* J5 F! e- _( W! F1 U5 E
  69. dma_addr_t dmaphyssrc2 = 0;
    / ]' t- q2 Y6 x0 C9 s" X
  70. dma_addr_t dmaphysdest1 = 0;+ v. W% d' ?2 j, T: V7 ~
  71. dma_addr_t dmaphysdest2 = 0;  x/ z5 C' g1 }" Q+ C

  72. , u5 o! u* L' ~/ S
  73. char *dmabufsrc1 = NULL;, m: N5 D8 g0 L% z0 v* n4 Y
  74. char *dmabufsrc2 = NULL;
    " I$ j& Q2 E) [) y7 h
  75. char *dmabufdest1 = NULL;( z+ O9 i8 Z! h7 v- C( f- C
  76. char *dmabufdest2 = NULL;
    / O; I" i1 [" a& U! {

  77. ( }" g+ x( r. L
  78. static int acnt = 512;6 Q" F: w5 A! T0 H7 ^. x8 [4 l6 h
  79. static int bcnt = 8;
      G; Q# Q% q3 @9 {
  80. static int ccnt = 8;' G; u% j& E- g+ C: i; W2 D
  81. 4 g9 D& H+ c5 B) C% @. K; B/ [
  82. module_param(acnt, int, S_IRUGO);9 {/ @! `( K" Y+ c( \! t  Q
  83. module_param(bcnt, int, S_IRUGO);
    * A8 e( T- ~' B- C* @; I) w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 [: H: c( h! _

+ H& ~: x- m: k& I" E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  ]3 X* T1 \1 c5 x2 n  K0 ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ B8 |+ V* X6 L. H1 q: z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 E" o+ }* O& h/ h; o2 H6 W8 Q$ T) t0 v
4 @- v; ~1 p$ v, d4 Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-6 18:45 , Processed in 0.043848 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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