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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / I% W4 I0 j: k1 ~" B! {2 a
  1. [code]EDMA sample test application
    3 j. t% ?1 P/ S. h1 z
  2. /*( H, R& k3 M  e' X( I( N. C$ Y
  3. * edma_test.c
    1 B! }1 F1 ~& q+ s* R
  4. *# R  q7 z$ H3 D- E" R! D
  5. * brief  EDMA3 Test Application
    . u* i! D9 R8 \6 J" I3 `0 J' ]
  6. *
    2 p$ ?; H2 O4 I1 |' y
  7. *   This file contains EDMA3 Test code.
    6 T2 W; {3 d! ?0 D9 k- `
  8. *) C1 O* N' C/ H& k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 b# z* g  c! d; J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 V( S$ m: P" w6 [
  11. *         TO CHANGE.' ], y- a' ]4 I. w9 B& N3 H
  12. *& |2 m. `. W( s, I( V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 Y$ f2 t& D7 J2 H) [' ~2 ~' u2 u
  14. *
    6 _+ b, Q2 ]& v) C. [0 M
  15. * This program is free software; you can redistribute it and/or
    ) U. c. h! D% B- }
  16. * modify it under the terms of the GNU General Public License as
    # k* B) g% K) v* t; [$ v$ r
  17. * published by the Free Software Foundation version 2.1 Q1 D) _& W% }( K) {8 }0 k; {
  18. *
    / c2 J* x1 F/ d7 G. `+ L0 a% L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 u1 M  `% o) w$ @. ]0 G4 F
  20. * kind, whether express or implied; without even the implied warranty" t, h$ a, o4 U! {# e2 d8 v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( u! d, V5 m. n( [! P. u- T* Q, }
  22. * GNU General Public License for more details.
    - l( e6 P; x3 ]' Y
  23. */
    3 O& \  o& [/ W# s4 E# D

  24. / W( |# W: Q" v5 o; {/ {
  25. #include <linux/module.h>
    / a1 \; C) D6 X' W2 i' ^0 W
  26. #include <linux/init.h>9 i  e+ H0 d$ ]5 ~% F
  27. #include <linux/errno.h>
    3 Y' G  @- q5 |2 }  T2 \4 Y
  28. #include <linux/types.h>
    ( B& `4 n+ Z+ H9 @
  29. #include <linux/interrupt.h>" S+ Y3 ^% F; l( g3 A
  30. #include <asm/io.h>5 J+ L" y0 N8 k7 Q
  31. #include <linux/moduleparam.h>
    , k7 X9 g7 X; i* }
  32. #include <linux/sysctl.h>6 M/ z! o1 [; [/ ?7 B6 `! h9 }) S
  33. #include <linux/mm.h>
    5 S! d+ ?. L# }# {7 Y: P
  34. #include <linux/dma-mapping.h>
    2 P+ y6 Z/ Q+ I+ X- ?
  35. * S3 [+ A/ X9 v( ~% h: k% f2 ^
  36. #include <mach/memory.h>
    / y' `* N7 i2 r/ r9 f4 G) p
  37. #include <mach/hardware.h>
    $ Z% R* S( \, j! A4 C
  38. #include <mach/irqs.h>! u: r, \5 e5 p/ v6 u+ S- V
  39. #include <asm/hardware/edma.h>$ ~4 S( `% i- b7 t6 F6 {2 H- `! }
  40. . j: l+ T! b5 A) L5 C
  41. #undef EDMA3_DEBUG
    - Q' f* ^: ]$ u' i
  42. /*#define EDMA3_DEBUG*/! m6 o! X' r4 W! T  @8 f
  43. $ x- p( F, D  r$ F5 D. X0 g& g
  44. #ifdef EDMA3_DEBUG
    1 ^- {! ]' i% T9 S, I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - n! O9 d. \0 f: h0 G5 T2 ?1 K" U$ o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* D# n8 q; o0 |# k8 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 E& t0 f! {) T' J( ^
  48. #else4 v! b" F! M" t
  49. #define DMA_PRINTK( x... )/ {5 p  O# J% Q" c* b6 Q8 i
  50. #define DMA_FN_IN) a1 \+ H* [6 A/ t5 G9 I; x0 z& Y
  51. #define DMA_FN_OUT
    / y( a) ~# ~2 B2 @9 p' N; Q
  52. #endif
    " N% r% Y8 o' _1 g: j+ l. H) m( g
  53. * r( c; b" f; d( Z5 I! m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & ~$ h* K3 a1 q9 C
  55. #define STATIC_SHIFT                34 o' o3 L9 {6 R, k
  56. #define TCINTEN_SHIFT               20
    8 s! T8 E9 ]: S" l6 {# h: W: @$ o# c) J
  57. #define ITCINTEN_SHIFT              21
    $ x  B6 [" q* e
  58. #define TCCHEN_SHIFT                22* S/ B+ B8 _4 O8 r; I' _) R
  59. #define ITCCHEN_SHIFT               23' [+ k. r2 _3 k# l3 X

  60. 2 l; W+ \4 u2 C/ `
  61. static volatile int irqraised1 = 0;
    1 G8 D" O, ]! |! P
  62. static volatile int irqraised2 = 0;% F% l! ?* i+ t4 G
  63. 0 T7 T7 Q% T0 K- J  x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ y" _5 u. G7 ~1 n7 o. Z' j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : X* l  ?0 l7 S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 m2 H+ D: @  D1 s, J
  67. + L# w1 X5 A; D: n9 y# \
  68. dma_addr_t dmaphyssrc1 = 0;
    ! q9 t( O4 s7 R
  69. dma_addr_t dmaphyssrc2 = 0;# ~$ u1 x6 a6 \$ P' A; w
  70. dma_addr_t dmaphysdest1 = 0;. u( u& B% B' r; S( b
  71. dma_addr_t dmaphysdest2 = 0;
    . n' ]/ H! Z  a; [% v

  72. / t( c! r$ d$ T& N% s! m$ B
  73. char *dmabufsrc1 = NULL;" C- h, b7 e  T3 d4 i8 H; l
  74. char *dmabufsrc2 = NULL;/ x4 T$ @  Y* V( t. W
  75. char *dmabufdest1 = NULL;
    . |. Y; a: Z5 W8 _" d
  76. char *dmabufdest2 = NULL;0 l( |% I# c2 |# Y
  77. 5 Q5 B% u+ F; L( k( {- n6 m
  78. static int acnt = 512;
    3 _) ~1 j! T- b6 w1 n
  79. static int bcnt = 8;
    - |/ y! J$ A% q: M, H4 s
  80. static int ccnt = 8;( x% i7 |# w* `. l9 g

  81. 4 x0 k& e: ^5 k4 ^  W& H, o; E8 E# @
  82. module_param(acnt, int, S_IRUGO);
    9 i! g/ b. w, w: r6 e- @6 P' X
  83. module_param(bcnt, int, S_IRUGO);5 R; y9 P) Y1 T5 V8 ^1 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. @' I7 p6 W7 I/ v
/ d3 y! `3 ?/ O+ \) _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- ~  m3 ^: c" b- q4 A
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 D3 d. P- F3 [: e! D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# K4 u. K5 _" U! y. \9 n0 X+ ^  U& L) }1 b% f( [

2 q4 T& {. w. a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-11 13:40 , Processed in 0.043023 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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