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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* I$ h: u. y1 ]6 p
  1. [code]EDMA sample test application' I* s, t% p) M' T! J/ l9 B
  2. /*
    3 I) p* P! r' D
  3. * edma_test.c$ t7 J; k( W* b* Z: o* F
  4. *
    & J& d2 t. Z& i! _: O$ J
  5. * brief  EDMA3 Test Application
    # j! S4 V: H* W4 k3 M
  6. *
    3 c* r+ b- N1 E; Z3 d: y. Y+ @
  7. *   This file contains EDMA3 Test code.; Y" k. \7 Y2 r5 ]2 w* s5 E& z* H
  8. *
    : w$ f: s# a* I$ x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 j. b8 M7 k! c! `( _/ F1 P! [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 N( U+ t# k* O* d! A( U
  11. *         TO CHANGE.' o: i5 g( h  c. V8 A
  12. *5 a+ B9 g, R5 f% E( |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 n3 p' I. B$ u8 y" V
  14. *9 [! y! o; @; O( B+ i5 C% m
  15. * This program is free software; you can redistribute it and/or
    ) V- R" j) V) N; G1 I8 C; Y+ J
  16. * modify it under the terms of the GNU General Public License as
    ! E: Z6 P, J) [4 [6 U% K/ N
  17. * published by the Free Software Foundation version 2.
    : x, [9 \6 Z6 Z6 M" e+ V5 m  S
  18. *. [0 P# l1 y' R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , [0 Z" \9 ~3 p: n
  20. * kind, whether express or implied; without even the implied warranty4 j7 O; u/ y# ~5 P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ ?' F' y8 w! P6 `9 l; G
  22. * GNU General Public License for more details.: t# C+ H+ I; T
  23. */! z9 d% X1 H9 H* R9 i& m8 \% l

  24. % [9 ~" _2 G& v+ a
  25. #include <linux/module.h>
    / u# a+ Y) E6 }; `1 `/ `7 \6 {
  26. #include <linux/init.h>+ z) |, a& A' ?7 t# R8 d% K
  27. #include <linux/errno.h>
    / p* x/ K# D7 E
  28. #include <linux/types.h>3 l' [3 S# k5 o# G' m
  29. #include <linux/interrupt.h>
    ; U5 y6 A: T% ]3 A! ^0 c
  30. #include <asm/io.h>
    & N' I3 D3 e. |% X
  31. #include <linux/moduleparam.h>
    / x6 p, e& ]0 x- @
  32. #include <linux/sysctl.h>5 r$ `$ O% K/ g0 g0 V1 ^: t9 S
  33. #include <linux/mm.h>% M) B+ j1 D% c# R
  34. #include <linux/dma-mapping.h>
    6 Y7 O( j' w% V- E% |, ~$ X; h6 a
  35. 4 f: G, j) d7 [
  36. #include <mach/memory.h>
    2 H- T% J- i2 v8 k6 J+ }6 c
  37. #include <mach/hardware.h>: Y- X/ `2 R; H, ^$ Z' g0 M5 ]3 A
  38. #include <mach/irqs.h>. A" O' U( v$ n) b; E8 j
  39. #include <asm/hardware/edma.h>
    ( e/ {2 d- {' ?1 u

  40. 0 Z, x# z! l8 t# k' F6 N- Z2 g
  41. #undef EDMA3_DEBUG
    ) P1 _' G% F0 L# O
  42. /*#define EDMA3_DEBUG*/
    % t2 |3 P8 ?' E/ n- K; Q6 }6 S5 \: D

  43. 5 a2 K7 \8 M3 g( B( Q
  44. #ifdef EDMA3_DEBUG% Z3 t- {2 F' e/ T: G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      }* n8 d& k' h9 q, ~( X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! B# Q  f1 j" C, o8 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; T, @- b3 j2 Q  N
  48. #else
    + K5 \7 Q; Z; d) L% r. V
  49. #define DMA_PRINTK( x... )
    - K, q# u5 _/ Z
  50. #define DMA_FN_IN. x; b3 {( ~0 j2 i( J6 I
  51. #define DMA_FN_OUT5 s, G4 _* `# r. t3 x- k
  52. #endif, V% I, z0 I  p! q) }5 ]) C  c2 \

  53. ) ]- p: s0 C' u; R6 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" U4 R# l. |& s6 l1 |; ~0 f
  55. #define STATIC_SHIFT                3
    ) e8 C9 {1 `1 a4 G1 A
  56. #define TCINTEN_SHIFT               20, e1 }' v% w* _+ j% D+ E
  57. #define ITCINTEN_SHIFT              211 w! ]2 n+ V& X% t3 \0 k
  58. #define TCCHEN_SHIFT                22
    0 g+ V% Y8 ]* g0 N- g7 ^+ A
  59. #define ITCCHEN_SHIFT               23+ L. S) H9 N9 E- N6 r' {. V' b6 _2 @
  60. 2 ]0 @) h( K( [) H
  61. static volatile int irqraised1 = 0;, N/ n$ F1 ^) |* U& w' T8 R5 P/ d7 ^
  62. static volatile int irqraised2 = 0;5 k% a6 |% J) U& R6 p: r$ V$ [

  63. # Q2 F1 c/ I8 Z% O% f# ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, e# q% b$ B3 `7 q: z, j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) W/ D: D& F3 X; ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ F# i. n# F2 l5 k8 P3 A
  67.   \5 ^: ]# e5 W9 y6 I
  68. dma_addr_t dmaphyssrc1 = 0;
    9 a. R7 ?) L$ s0 q# }' M. \
  69. dma_addr_t dmaphyssrc2 = 0;
    , \* T. y! e" ^) F
  70. dma_addr_t dmaphysdest1 = 0;0 f0 g7 ?' ~; S' t3 e+ }# c- _
  71. dma_addr_t dmaphysdest2 = 0;
    $ H# Y! q; @  d* u6 e2 _* }3 x
  72. . M6 _1 X+ f% O. I2 e
  73. char *dmabufsrc1 = NULL;
    6 s9 @/ `7 f5 }6 y
  74. char *dmabufsrc2 = NULL;
    % T0 R' p" ]+ @
  75. char *dmabufdest1 = NULL;
    7 r0 i; a$ P* A0 I
  76. char *dmabufdest2 = NULL;
    & B7 m5 z5 ?4 t6 T) ?# x

  77. 7 ]* a/ A1 `. h- v  y
  78. static int acnt = 512;
    4 ?2 x! y# w* T6 s+ }* t' H8 W+ Y
  79. static int bcnt = 8;
    ( Y; J& }# `  I2 }0 m! ]
  80. static int ccnt = 8;
    3 \+ f' I9 r" {/ n

  81. 2 Y4 G/ O- ^2 A9 k& I
  82. module_param(acnt, int, S_IRUGO);" N3 D) }9 o0 x, V7 E
  83. module_param(bcnt, int, S_IRUGO);
    5 ]& S& h+ C. A0 r3 P  r
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 D# \/ c7 S8 l- w% r7 D- W2 \9 u

2 f# l! S2 w- O/ J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 u$ s! W1 _4 n: T9 `4 d0 darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# W. W+ k- S7 b; n6 u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 x( _6 \4 \% c$ r1 V& y1 p) D
- T8 g; f2 L$ s# U7 ]7 X
; \5 f1 ^! {4 S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 19:05 , Processed in 0.038428 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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