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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 N! L6 y& R" B; i+ T
  1. [code]EDMA sample test application
    6 i" L8 @  ?1 s9 w. v- U  i
  2. /*
    ! e5 k9 U, f  c0 L7 b4 }
  3. * edma_test.c2 s1 y$ R! |- u
  4. *
    ! }( U+ d9 z7 @7 V* O! x
  5. * brief  EDMA3 Test Application/ e2 b8 E8 u( f# q) P7 J( t, C
  6. *
    6 F+ w) h0 A# B' A, x% E& w8 E
  7. *   This file contains EDMA3 Test code.
    4 ]9 m! i  v5 b4 i
  8. *# F& x% p  V7 m# h4 a5 W+ C: [) b7 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* A( |7 s! t! q! \1 t' x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; p5 S' ]8 p/ K" f! J& s
  11. *         TO CHANGE.  r+ }  ^. d4 l) f( W
  12. *
    $ G0 Y: l  _5 M1 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ [# w5 v8 N' t! {+ i. u
  14. *
    & f) a0 O1 J  V
  15. * This program is free software; you can redistribute it and/or6 Y& J) E8 B- E$ U* m
  16. * modify it under the terms of the GNU General Public License as
    + [. a- B& ?$ h! [; R! s
  17. * published by the Free Software Foundation version 2.
    1 l0 A( l  Y( Q5 B2 h6 i+ @% B
  18. *3 E, j' T9 @0 |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : r, _4 t% M# h
  20. * kind, whether express or implied; without even the implied warranty% @" e# R0 S6 o/ O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . N. z+ ~! j& |0 H8 i5 z
  22. * GNU General Public License for more details.
    8 \" x" w% j( s+ G% o6 P
  23. */
    . \$ r9 B; a, Q/ x' A
  24. ( x0 z6 V9 P& g
  25. #include <linux/module.h>
    1 ~6 c/ [9 p2 ]" Q/ O
  26. #include <linux/init.h>5 d7 s% S5 W! o% [
  27. #include <linux/errno.h>% I2 ?6 f. E# u8 h$ {) o3 v
  28. #include <linux/types.h>
    ; f; S  v" Z3 y% F/ _
  29. #include <linux/interrupt.h>, b0 @5 n9 `( {- E
  30. #include <asm/io.h>
    , D  B3 H8 E. @) y& p, s
  31. #include <linux/moduleparam.h>
    ' W) Y" I; E- F2 \0 g- @% r
  32. #include <linux/sysctl.h>$ x1 |0 Z8 l$ a: |! O
  33. #include <linux/mm.h>+ Y/ ~# z* i/ ^; J6 r8 s
  34. #include <linux/dma-mapping.h>6 J2 U; C  @2 v5 V; X  W

  35. ; V4 _# F  V& b9 O
  36. #include <mach/memory.h>
    , J2 u& k/ y) }0 ^* u. e
  37. #include <mach/hardware.h>* ^# B6 U1 r8 d5 a* @
  38. #include <mach/irqs.h>1 R0 G6 o. R4 B" i, S" m/ f
  39. #include <asm/hardware/edma.h>; R- `& ~3 c# m4 |+ v, e

  40. * u: b9 p4 D" x) J+ b
  41. #undef EDMA3_DEBUG
    9 m) Y% ^7 C- G9 r3 u6 S
  42. /*#define EDMA3_DEBUG*/
    & d% _* E$ U% g- w2 Z" m" B6 {

  43. ( U2 ?% F" I# A0 s
  44. #ifdef EDMA3_DEBUG! @- g( a- q# C6 }$ ^* ?) n& A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), ~' l# X9 L4 m/ d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 `4 j' {( ]7 d, s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , T0 W& o( k+ h, I3 @- c9 y  F0 g
  48. #else0 V' B  t0 r1 x0 ~3 o- E
  49. #define DMA_PRINTK( x... )# t0 j1 d! P9 X$ a% L2 O( J$ W, F; U
  50. #define DMA_FN_IN3 R4 A8 q. E; Y) O
  51. #define DMA_FN_OUT
    ' G. e% j% t5 Q) @; P3 a  r
  52. #endif9 I% h6 [0 ^  g- d: T
  53. * F/ A' i5 `" {0 l9 R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): e4 S; }$ z. h' N2 P3 h
  55. #define STATIC_SHIFT                34 |+ _. U; Q- a
  56. #define TCINTEN_SHIFT               20) @; N* B- k# D" M) K% J; L
  57. #define ITCINTEN_SHIFT              21
    4 g' C1 d8 K, F! B8 B
  58. #define TCCHEN_SHIFT                229 g# ^$ z" Y, P. ?$ Y4 K
  59. #define ITCCHEN_SHIFT               235 P2 d  S# r- ]. }. P' s2 D' {' }
  60. + ^/ d4 _, ^' w- \3 t. W% ^! o( E
  61. static volatile int irqraised1 = 0;; Z7 [* r" S. F% J
  62. static volatile int irqraised2 = 0;
    1 f$ h) O$ Z( Q# W& z
  63. * H4 M# ?! N8 L5 C; s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ N( N8 D* @" p+ b# B# ~: ^. w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 N4 z/ {$ @9 Z' Z6 y/ b* X" s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, r/ y9 ?2 b, K* k
  67. : J; a: `7 X- }$ L) R- c
  68. dma_addr_t dmaphyssrc1 = 0;8 Y/ e2 Z1 e* c/ V% C
  69. dma_addr_t dmaphyssrc2 = 0;
    $ z7 A% S% n+ s
  70. dma_addr_t dmaphysdest1 = 0;
    - y2 X- A0 Y( R% z
  71. dma_addr_t dmaphysdest2 = 0;
    4 S7 q; _/ n' ?* |( O6 N
  72. ) R( B# }" G- a/ n  ?5 E
  73. char *dmabufsrc1 = NULL;* J4 @. Y+ I& k2 X! M" t1 c2 K* Z
  74. char *dmabufsrc2 = NULL;/ G4 o* n% o  d/ x0 c
  75. char *dmabufdest1 = NULL;" l: p# N; R' B5 n* H/ c8 L0 V
  76. char *dmabufdest2 = NULL;( P- i# a# P. I  i' T. X9 \

  77. 1 O. P1 s2 ?8 I* g
  78. static int acnt = 512;
    2 f! Y, F6 a( Z
  79. static int bcnt = 8;
    + W5 y" b. [3 r
  80. static int ccnt = 8;+ E* u+ \, h' x5 X/ T
  81. 1 H( A1 n9 W& U$ S
  82. module_param(acnt, int, S_IRUGO);
    & ?9 I& S. _+ l4 f1 _' g- T9 V
  83. module_param(bcnt, int, S_IRUGO);
    & ^# n' y2 ]7 w" k5 F6 \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 Q) Y# _7 U1 r4 ~& w& {  f0 n$ v
4 ]4 u' B% h: s7 H( H  H- P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 l$ ]' V# u" O9 Z2 farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 }0 e0 t1 L5 d# Q1 Z7 K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. F( t+ r, B: ~9 ^+ X0 [
+ A9 }9 q: V; l1 y
& I' B" D% f3 c/ z/ `0 L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-24 13:47 , Processed in 0.038958 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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